#include <iostream>
#include <algorithm>

using namespace std;

long long __lcm (int (*A)[3001], int N){
    long long lcm = (*A)[0];
    for (int i = 0; i < N; i++)
        lcm = (((*A)[i]*lcm) / __gcd((long long)(*A)[i], lcm));
    return lcm;
}

int main(){
    int N; cin >> N; int A[3001];
    for (int i = 0; i < N; i++) cin >> A[i];
    long long m = __lcm(&A, N)-1; long long f = 0;
    for (int i = 0; i < N; i++) f += m % A[i];
    cout << f << endl;
    return 0;
}
