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

int main(){

    int N;
    cin >> N;
    vector<ll> a(N);
    for (int i=0; i<N; i++) cin >> a.at(i);

    ll mul_buf, mul;
    ll div_buf, div;
    div = __gcd(a.at(0), a.at(1));
    mul = (a.at(0)*a.at(1))/div;
    for (int i=2; i<N; i++){
        div = __gcd(mul, a.at(i));
        mul = (mul*a.at(i))/div;
    }

    ll ans = 0;
    for (int i=0; i<N; i++) ans += (mul-1)%a.at(i);

//    cout << mul << endl;
    cout << ans << endl;
    return 0;
}