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