#include <iostream>
#include <algorithm>

using namespace std;

long long a[3001];
long long MOD,cmmdc,Prod,N,S;

int main()
{
    cin >> N >> a[1];
    cmmdc = Prod = a[1];
    for(int i = 2; i <= N; ++i)
    {
        cin >> a[i];
        cmmdc = __gcd(cmmdc,a[i]);
        Prod *= a[i];
    }
    MOD = (Prod / cmmdc) - 1;
    for(int i = 1; i <= N; ++i)
        S += MOD % a[i];
    cout << S;
    return 0;
}
