#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
ll a[3005];
ll lcm(ll x,ll y)
{
    return ((x*y)/(__gcd(x,y)));
}
int main()
{
    ft
    ll t,i,j,n,m,l=1,r,s=-2e17;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        l=lcm(l,a[i]);
    }
    m=l-1;
    l=0;
    for(j=0; j<n; j++)
    {
        l+=(m%a[j]);
    }
    cout<<l<<"\n";
    return 0;
}

