#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


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


int main() {

    int n;
    cin >> n;

    vi a(n);
    ll l = 1;
    fo(i, n) {
        cin >> a[i];
        l = lcm(l, a[i]);
    }
    l--;
    ll ans = 0;
    fo(i, n) ans += l % a[i];

    cout << ans << endl;

    return 0;
}