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