#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 3e3 + 5;

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

int n;
int a[MAXN];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);

    cin >> n;
    REP(i, n)
        cin >> a[i];

    ll m = a[0];
    FOR(i, 1, n)
        m = gcm(m, a[i]);

    ll sol = 0;
    m --;

    REP(i, n)
        sol += m % a[i];

    cout << sol;
}
