#include <bits/stdc++.h>
using namespace std;

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) (a.begin(), a.end())
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

ll a[3000];
ll n;

ll f(ll m) {
	ll res = 0;
	for (int i = 0; i < n; ++i) {
		res += m%a[i];
	} 

	return res;
}

void solve() {
	
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	ll g = a[0];
	ll lcm = a[0];
	for (int i = 0; i < n; ++i) {
		g = __gcd(g,a[i]);
		lcm = lcm / g * a[i];
	}
	--lcm;
	cout << f(lcm) << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

	//////// End Initialization ///////////////////////////////////////