#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define EPS 1e-14
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};


int main(){

    ull n, a[30002], i, lcm, sum=0;
    cin>>n;
    for(i=0;i<n;i++) cin>>a[i];
    lcm=(a[0]*a[1])/__gcd(a[0],a[1]);
    for(i=2;i<n;i++) lcm=(lcm*a[i])/__gcd(lcm,a[i]);
    lcm--;
    for(i=0;i<n;i++) sum+=(lcm%a[i]);
    cout<<sum<<endl;
    return 0;
}