n = int(input()) a = list(map(int,input().split())) x = sum(a) v = int(input()) print(x-v)