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