#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
  LL n;
  cin>>n;
  LL a[n];
  for(int i=0;i<n;++i) cin>>a[i];
  LL tmp;
  tmp=a[0]/__gcd(a[0],a[1])*a[1];
  for(int i=2;i<n;++i){
    tmp=tmp/__gcd(tmp,a[i])*a[i];
  }
  --tmp;
  LL ans=0;
  for(int i=0;i<n;++i){
    ans+=tmp%a[i];
  }
  cout<<ans<<endl;
  return 0;
}