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