n = int(input()) A = list(map(int,input().split())) x = int(input()) sum_A = sum(A) print(sum_A - x)