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