f=lambda:list(map(int,input().split()))
N=int(input()); A=[0]+f()
print(sum(A[i+1]-(A[i]+1) for i in range(N)))