#!/usr/bin/python # -*- coding: utf-8 -*- N = int(raw_input()) arys = map(int, raw_input().split()) yuki = int(raw_input()) print sum(arys) - yuki