#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

ll lcm(ll a, ll b) {
    if (a == 0 || b == 0)
        return 0;

    return a / __gcd(a, b) * b;
}

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


