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