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