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