#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  ll LCM;
  for (int i = 0; i < N; ++i) {
    cin >> a.at(i);
    if (i == 0) {
      LCM = a.at(i);
      continue;
    }
    ll aa, b, r;
    if (LCM < a.at(i)) {
      aa = a.at(i);
      b = LCM;
    } else {
      aa = LCM;
      b = a.at(i);
    }
    r = aa % b;
    while (r != 0) {
      aa = b;
      b = r;
      r = aa % b;
    }
    LCM = LCM / b * a.at(i);
  }
  --LCM;
  ll ans = 0;
  for (int i = 0; i < N; ++i) ans += LCM % a.at(i);
  cout << ans << endl;
  return 0;
}
