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