import numpy as np N = int(input()) A = (int(i) for i in input().split()) v = int(input()) print(np.sum(A) - v)