#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

int main()
{
    ll n ;
    cin>>n ;
    ll arr[n] ;
    for(ll i = 0 ; i < n ; ++i)
        cin>>arr[i] ;
    ll x = arr[0] ;
    for(ll i = 1 ; i < n ; ++i)
    {
        x = x * 1LL* arr[i]*1LL / __gcd(x*1LL , arr[i]*1LL)*1LL;
    }
    x--;
    ll ans = 0 ;
    for(ll i = 0  ; i < n ; ++i)
        ans += (x % arr[i]);
    cout<<ans<<endl;
    return 0 ;
}
