#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;int x[N]; int y;
    rep(i,N){
        cin >> x[i];
        if(i==0) y=x[i];
        else y=lcm(x[i],y);
    }
    int ans=0;
    rep(i,N){
        ans+=(y-1)%x[i];
    }
    cout << ans << endl;

    return 0;
}