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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
ll gcd(ll a,ll b){
    ll r=a%b; 
    while(r!=0){ 
      a=b; 
      b=r; 
      r=a%b; 
    }
    return b;
}
ll koubai(ll a,ll b){
  return (a*b)/gcd(a,b); 
}
int main(){
  ll n;cin>>n;
  vector<ll>num(n);
  cin>>num[0];
  ll mae=num[0];
  for(int i=1;i<n;i++){
    cin>>num[i];
    mae=koubai(mae,num[i]);
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    ans+=(mae-1)%num[i];
  }
  cout<<ans<<endl;
  return 0;
}
