N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 for i, a in enumerate(A, 1): ans += abs(i - a) print(ans)