N = int(input()) A = list(map(int,input().split())) print(A[-1]-N)