
#include<bits/stdc++.h>
#include<utility>

using namespace std;
#define int long long
#define br cout<<"\n"
#define all(V) V.begin(),V.end()
#define rall(V) V.rbegin(),V.rend()
#define umap unordered_map
#define uset unordered_set

typedef vector<int> vi;
typedef vector<vi> vvi;

bool isPwrOf2(int x) { return x && (!(x&(x-1))); }
/*------------------------------------------------*/

/*------------------------------------------------*/

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    // #ifndef ONLINE_JUDGE
    //     freopen("./input.txt", "r", stdin);
    //     freopen("./output.txt", "w", stdout);
    // #endif
    /*------------------------------------------------*/
    int n; cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int lcm = arr[0];
    for(int i=1;i<n;i++){
        lcm = (lcm*arr[i])/(__gcd(lcm,arr[i]));
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        cnt += (lcm-1)%arr[i];
    }
    cout<< cnt;
    /*------------------------------------------------*/
    return 0;
}