Permutation *p* is an ordered set of integers *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p*<sub class="lower-index">*i*</sub>. We'll call number *n* the size or the length of permutation *p*<sub class="lower-index">1</sub>,  *p*<sub class="lower-index">2</sub>,  ...,  *p*<sub class="lower-index">*n*</sub>.

You have a sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. In one move, you are allowed to decrease or increase any number by one. Count the minimum number of moves, needed to build a permutation from this sequence.
The first line contains integer *n* (1 ≤ *n* ≤ 3·10<sup class="upper-index">5</sup>) — the size of the sought permutation. The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> ( - 10<sup class="upper-index">9</sup> ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
# def binary_search1(arr, x):
#     low = 0
#     high = len(arr) - 1
#     mid = 0
 
#     while low <= high:
 
#         mid = (high + low) // 2
 
#         # If x is greater, ignore left half
#         if arr[mid] < x:
#             low = mid + 1
 
#         # If x is smaller, ignore right half
#         elif arr[mid] > x:
#             high = mid - 1
 
#         # means x is present at mid
#         else:
#             return True
 
#     # If we reach here, then the element was not present
#     return False

# def binary_search(arr, x):
#     low = 0
#     high = len(arr) - 1
#     mid = 0
 
#     while low <= high:
 
#         mid = (high + low) // 2
 
#         # If x is greater, ignore left half
#         if arr[mid] < x:
#             low = mid + 1
 
#         # If x is smaller, ignore right half
#         elif arr[mid] > x:
#             high = mid - 1
 
#         # means x is present at mid
#         else:
#             return mid
 
#     # If we reach here, then the element was not present
#     return -1

# t = int(input())
# for i in range(t):
#     n = int(input())
#     a = list(map(int , input().split()))
#     b = list(map(int , input().split()))
#     a.sort()
#     b.sort()
    
#     # //removing the same elements
#     for j in list(a):
#         if binary_search1(b , j)==True:
#             var = binary_search(b , j)
#             # x[j] = 0
#             # y[var] = 0
#             a.remove(j)
#             b.remove(b[var])
#     # for j in range(n):
#     #     if x[j]!=0:
#     #         a.append(x[j])
#     #     if y[j]!=0:
#     #         b.append(y[j])
            
#     print(a, b)
    
#     c = []
#     d = []
#     ans = 0
#     for j in range(len(a)):
#         A = str(a[j])
#         B = str(b[j])
#         if len(A)!=1:
#             c.append(len(A))
#             ans+=1
#         else:
#             c.append(a[j])
#         if len(B)!=1:
#             d.append(len(B))
#             ans+=1
#         else:
#             d.append(b[j])

#     c.sort()
#     d.sort()
#     print(c , d)
#     for j in list(c):
#         if binary_search1(d , j)==True:
#             var1 = binary_search(d , j)
#             c.remove(j)
#             d.remove(d[var1])
            
#     # c.append(1)
#     # d.append(1)
#     # f1 = []
#     # f2 = []
#     var = 0
#     for j in range(len(c)):
#         if c[j]!=1:
#             var+=1
#     for j in range(len(d)):
#         if d[j]!=1:
#             var+=1
#             # f2.append(d[j])
#     # f1.sort()
#     # f2.sort()
    
#     # print(f1 , f2)
#     # var= 0
#     # for j in range(len(f1)):
#     #     if f1[j]!=1:
#     #         var+=1
#     # for j in range(len(f2)):
#     #     if f2[j]!=1:
#             # var+=1
#     print(ans+var)
n = int(input())
a = list(map(int , input().split()))
ans = 0
a.sort()
for j in range(n):
    if a[j] > j+1:
        ans += (a[j] - j-1)
    else:
        ans+= (j+1 - a[j])
print(ans)