# coding: utf-8 n = int(input()) a = [int(i) for i in input().split()] v = int(input()) print(sum(a) - v)