/*input
3
3 4 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

ll lcm(ll a, ll b)
{
	return (a * b)/__gcd(a, b);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    int ans = 0;
	ll l = 1;
	vector<ll> a(n);
    for(int i = 0; i < n; i++)
    {
    	cin >> a[i];
    	l = lcm(l, a[i]);
    }
    for(int i = 0; i < n; i++) ans += (l - 1) % a[i];
    cout << ans;

    return 0;
}