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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    vector<ll> A;
    ll N;
    ll count = 0;
    ll m = 1;
    cin >> N;
    A.resize(N);
    for(ll i = 0;i < N;i++) {
        cin >> A[i];
        m = m * A[i] / __gcd(m, A[i]);
    }
    m--;
    for(auto &i: A) count += m % i;
    cout << count << endl;
    return 0;
}
