import sys readline=sys.stdin.readline N=int(readline()) A=list(map(int,readline().split())) v=int(readline()) ans=sum(A)-v print(ans)