#include #define LL long long #define ULL unsigned long long #define REP(i, n) for(int i=0; i<(n); i++) #define REP2(i, x, n) for(int i=x; i<(n); i++) #define SORT(n) sort((n).begin(), (n).end()) #define SORT2(n) sort((n).begin(), (n).end(), greater()) using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector vc(n); REP(i,n){ cin>>vc[i]; } int res = accumulate(vc.begin(), vc.end(), 0); int ans; cin >> ans; cout << res - ans << endl; return 0; }