input() s=map(int,raw_input().split()) f=input() print sum(s)-f