#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define Author std::ios_base::sync_with_stdio(0);
#define ABHISHEK_SHARMA cout.tie(0);
#define IIIT_ALLAHABAD cin.tie(0);

ll lcm(ll a, ll b){
    return (a*b)/__gcd(a,b);
}

int main(){
    //Booster
    Author
        ABHISHEK_SHARMA
        IIIT_ALLAHABAD
    //Driver Code here
    ll n, i, l, h, m, ans=0;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++){
        cin>>a[i];
    }
    h=a[0],l=1;
    for(i=0; i<n; i++){
        l=lcm(l,a[i]);
    }
    m=l-1;
    for(i=0; i<n; i++){
        ans=ans+(m)%a[i];
    }
    cout<<ans;
    return 0;
}