#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

void solve(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll lcm = a[0];
    ll ans = 0;
    rep(i, n - 1)
    {
        lcm = a[i + 1] * (lcm / __gcd(a[i + 1], lcm));
    }
    --lcm;
    rep(i, n)
    {
        ans += lcm % a[i];
    }
    cout << ans << endl;
}
int main(void) { solve(); }