#include <bits/stdc++.h>
#include<string>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main(){
  ll N;cin>>N;
  vector<int> vec(N);
  REP(i,0,N)cin>>vec[i];
  sort(all(vec),greater<>());
  ll l=vec[0],ans=0;
  REP(i,1,N){l=lcm(l,vec[i]);}
  // REP(i,1,l){
  //   ll tmp_ans=0;
  //   REP(j,0,N){
  //     tmp_ans+=i%vec[j];
  //   }
  //   ans=max(ans,tmp_ans);
  // }
  ll tmp_ans=0;
  REP(j,0,N){
    tmp_ans+=(l-1)%vec[j];
  }
  print(tmp_ans)

}
