N = int(input()) l = list(map(int, input().split())) yans = int(input()) print(sum(l) - yans)