from Queue import * # Queue, LifoQueue, PriorityQueue from bisect import * #bisect, insort from collections import * #deque, Counter,OrderedDict,defaultdict #set([]) import math import copy import itertools import string import sys myread = lambda : map(int,raw_input().split()) def solver(): N = int(raw_input()) nums = myread() v = int(raw_input()) print sum(nums) - v if __name__ == "__main__": solver()