#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
typedef pair<long long, long long> P;

int main(){
    long long n;
    cin>>n;
    vector<long long>a(n);
    rep(i,n){
        cin>>a[i];
    }
    long long ans=a[0];
    rep11(i,n){
        long long jk=ans;
        jk=__gcd(jk,a[i]);
        ans=ans*a[i]/jk;
    }
    long long sum=0;
    rep(i,n){
        sum+=(ans-1)%a[i];
    }
    cout<<sum<<endl;
}