#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  int N; cin >> N;
  vector<ll> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  ll number = a[0];
  for(int i = 1; i < N; i++){
    number = number/__gcd(number, a[i]) * a[i];
  }
  --number;
  ll ans = 0;
  for(int i = 0; i < N; i++){
    ans += number%a[i];
  }
  cout << ans << endl;
}