#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

ll gcd(ll x,ll y){
  if(x<y) swap(x,y);
  ll r;
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  return x;
}
int main(){
  int n;
  cin>>n;
  ll a[n+1]={};
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  ll g=gcd(a[0],a[1]);
  for(int i=2;i<n;i++){
    g=gcd(g,a[i]);
  }
  ll ans=1;
  for(int i=0;i<n;i++){
    ans=(ans/g)*(a[i]/g)*g;
  }
  ll tmp=0;
  for(int i=0;i<n;i++){
    tmp+=(ans-1)%a[i];
  }
  cout<<tmp<<endl;
  return 0;
}
