#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0;
  cin >> N;
  vector<long long> a(N), A(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    A[i] = a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < N - 1; i++) {
    long long r = a.at(i) % a.at(i + 1), x = a.at(i) * a.at(i + 1);
    while (r != 0) {
      a.at(i) = a.at(i + 1);
      a.at(i + 1) = r;
      r = a.at(i) % a.at(i + 1);
    }
    a.at(i + 1) = x / a.at(i + 1);
  }
  for (int i = 0; i < N; i++) {
    ans += (a[N - 1] - 1) % A.at(i);
  }
  cout << ans << endl;
}
