n=int(input()) l=list(map(int,input().split())) c=int(input()) print(sum(l)-c)