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