N = int(input()) A = list(map(int,input().split())) print(abs(sum(A)-((N+1)*N)//2))