n = int(input()) a = list(map(int,input().split())) b = int(input()) suma = sum(a) print(suma - b)