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