//----------------------------------------------------------------------
#include <bits/stdc++.h>
#include <cstddef>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;


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

int main(void) {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll max_lcm = lcm(a[0],a[1]);

    rep(i, n) {
        max_lcm = lcm(max_lcm, a[i]);
    }

    ll ans = 0;
    rep(i, n) {
        ans += (max_lcm-1) % a[i];
    }
    cout << ans << endl;

    return 0;
}
