#coding: utf-8 #yuki369 n=int(raw_input()) s=map(int,raw_input().split()) v=int(raw_input()) print sum(s)-v