N = int(input()) A = list(map(int, input().split())) v = int(input()) print(sum(A)-v)