#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
ll a[MAXN];


int main() {
    int n;
    cin >> n;
    ll gcc = 1;
    for (int i = 1; i <= n; i++) {
        ll t;
        cin >> t;
        gcc = gcc / __gcd(gcc, t) * t;
        a[i] = t;
    }
    gcc--;
    ll ans = 0;
    for (int i = 1; i <= n; i++)
        ans += gcc % a[i];
    cout << ans << endl;
    return 0;
}