N = int(input()) A = list(map(int, input().split())) V = int(input()) ans = sum(A) - V print(ans)