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