n = int(input()) q = list(map(int, input().split())) y_ans = int(input()) ans = sum(q) - y_ans print(ans)