#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

ll calc(ll m, vector<ll> a){
	ll res = 0LL;
	rep (i, (int)a.size()){
		res += (m % a[i]);
	} // end rep
	return res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<ll> a(N, 0LL);
	rep (i, N) cin >> a[i];
	sort(ALL(a));

	ll lcm = 1LL;
	rep (i, N){
		ll g = __gcd(lcm, a[i]);
		lcm = lcm * a[i] / g;
	} // end rep
//	cerr << "lcm: " << lcm << endl;
	
	ll res = calc(lcm - 1, a);
	cout << res << endl;

	return 0;
}