n = int(input()) B = list(map(int, input().split())) ans = 0 cum = 0 for i in range(n): cum += B[i] if cum != i+1: ans += abs(cum-(i+1)) print(ans)