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

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

    ll ans = 0;
    ll g = a[0];
    for (int i = 1; i < n; i++) {
        g = g / __gcd(g, a[i]) * a[i];
    }
    g--;
    rep(i, n) { ans += g % a[i]; }

    cout << ans << endl;
    return 0;
}
