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