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