#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
const int mxN = 3003;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    lld arr[mxN];
    for(int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    lld m = arr[0];
    for(int i = 1; i < n; ++i) {
        m = (m  / __gcd(arr[i], m)) * arr[i];
    }
    m--;
    lld ans = 0;
    for(int i = 0; i < n; ++i) {
        ans += (m % arr[i]);
    }
    cout << ans << endl;
    return 0;
}
