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