N=int(raw_input()) A=map(int,raw_input().split()) v=int(raw_input()) print sum(A)-v