#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
ll __lcm(ll a,ll b)
{
    ll gg=__gcd(a,b);
    ll pdt=a*b;
    ll lcm=pdt/gg;
    return lcm;
}
ll a[3005];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll hcf=__gcd(a[0],a[1]);
    ll pdt=1LL*a[0]*a[1];
    ll lcm=pdt/hcf;
    for(int i=2;i<n;i++)
    {
        lcm=__lcm(lcm,a[i]);
    }
    lcm--;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        ll p=lcm%a[i];
        sum+=p;
    }
    cout<<sum<<endl;
}
