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