n = input() a = [int(i) for i in input().split(' ')] v = int(input()) print(sum(a) - v)