N = input() A = map(int, raw_input().split()) v = input() print sum(A) - v