a=int(input()) b=[int(i) for i in input().split()] c=0 for i in b: c+=i print(int(input())-c)