#include <iostream>
#include <numeric>
using namespace std;
int main(){
    int N, a[3000];
    cin >> N >> a[0];
    long long int l = a[0];
    for (int i = 1; i < N; i++) {
        cin >> a[i];
        l = lcm(l, a[i]);
    }
    int f = 0;
    for (int i = 0; i < N; i++) f += (l - 1) % a[i];
    cout << f << endl;
}
