n = int(input()) l = [int(_) for _ in input().split()] l = sorted(l) nl = [i+1 for i in range(n)] ans = 0 for i in range(n): ans += nl[i] - l[i] print(ans)