#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define int long long
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;
namespace mp = boost::multiprecision;

mp::cpp_int gcd(mp::cpp_int a, mp::cpp_int b) {
    return (b == 0 ? a : gcd(b, a % b));
}

mp::cpp_int lcm(mp::cpp_int a, mp::cpp_int b) {
    return a * b / gcd(a, b);
}

signed main() {
    int n;
    cin >> n;
    vector <int> a(n);
    mp::cpp_int tmp = 1;
    rep (i, n) {
        cin >> a[i];
        tmp = lcm(tmp, a[i]);
    }

    tmp--;
    mp::cpp_int ans = 0;
    rep (i, n) ans += (tmp % a[i]);
    cout << ans << endl;
    return 0;
}
