N = int(input()) A = [int(x) for x in input().split()] yuki = int(input()) print(sum(A) - yuki)