N = int(input()) A = list(map(int, input().split())) v = int(input()) w_sum = sum(A) #yukiさんの間違った答え print(w_sum - v)