n=int(input()) a=[*map(int,input().split())] a.sort() ans=0 for i,v in enumerate(a): ans+=abs(i+1-v) print(ans)