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

#define      ll      long long int

const int N = 3005;
ll ara[N];
ll n;

ll val(ll x)
{
    ll s = 0, i;
    for (i = 1; i <= n; i++) {
        s += (x % ara[i]);
    }
    return s;
}

int main( )
{
    ll s = 0, i, j, k;
    cin >> n;
    cin >> ara[1];
    ll lcm = ara[1];
    for (i = 2; i <= n; i++) {
        cin >> ara[i];
        lcm = (lcm / __gcd(ara[i], lcm)) * ara[i];
    }
    s = val(lcm - 1);
    cout << s << '\n';
    return 0;
}
