n=int(input()) x=list(map(int,input().split())) v=int(input()) print(sum(x)-v)