#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

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