#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,ans=0,lcm=1;cin>>n;
  lvector a(n,0);
  rep(i,n) {
    cin>>a[i];
    lcm=(lcm*a[i])/__gcd(lcm,a[i]);
  }
  rep(i,n) ans+=(lcm-1)%a[i];
  print(ans);
  return 0;
}