n=int (input())
d=0
a=[]
for i in range(n):
    s=int(input())
    a[i]+=s
for c in range(n):
    if a[c]-c==0:
        d=d+0
    if a[c]-c>0:
        d=d+a[c]-c
    if a[c]-c<0:
        d=a[c]-c*-1+d
print(d)