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