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