n=int(input()) list=[int(i) for i in input().split()] m=0 for i in range(n): m=m+list[i] i=i+1 print(m-int(input()))