#include <bits/stdc++.h>
#define Task "C"

using namespace std;
const int maxN = 3e3 + 5;
long long n, a[maxN];

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i<=n; ++i) cin >> a[i];
    long long lcm = 1, res = 0;
    for(int i = 1; i<=n; ++i)
        lcm = a[i] / __gcd(a[i],lcm) * lcm;
    for(int i = 1; i<=n; ++i) res += (lcm-1) % a[i];
    cout << res;

    return 0;
}
