N = int(input()) A = list(map(int, input().split(' '))) U = int(input()) K = sum(A) I = int(K) - int(U) print(I)