# yukicoder No.369 足し間違い N = int(input()) A = [int(a) for a in input().split()] v = int(input()) print(sum(A) - v)