a = int(input()) b = map(int,input().split()) c = int(input()) print(sum(b)-c)