n = input() l = [int(x) for x in input().split()] total = sum(l) v = int(input()) print(total - v)