n = int(input()) a = [int(x) for x in input().split()] v = int(input()) res = sum(a) - v print(res)