N, *A, v = map(int, open(0).read().split()) print(sum(A) - v)