N = int(input()) A = [int(i) for i in input().split()] v = int(input()) print(sum(A) - v)