#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	ll N;
	cin >> N;
	vector < ll > a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	ll lcm = 1;
	for (int i = 0; i < N; i++) {
		lcm = lcm * a[i] / __gcd(lcm, a[i]);
	}

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += (lcm - 1) % a[i];
	}

	cout << ans << endl;

	return 0;
}
