#include using namespace std; int n, a, s, x; int main() { cin >> n; for(int i = 0; i < n; i++) cin >> a, s += a; cin >> x; cout << s - x << endl; }