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