#include <bits/stdc++.h>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    ll a[n];
    rep(n) cin >> a[i];
    ll g = gcd(a[0], a[1]), l = a[0]*a[1];
    reppp(i, 2, n){
        g = gcd(g, a[i]);
        l *= a[i];
    }
    l /= g;

    ll ans = 0;
    rep(n){
        ans += (l-1)%a[i];
    }
    cout << ans << endl;
}
