n=int(input()) a = map(int, input().split()) v = int(input()) sum = sum(a) print(sum-v)