#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  map<int, int> factor;
  for (int i = 0; i < (int)(N); i++) {
    cin >> a.at(i);
    int x = a.at(i);
    for (int i = 2; i <= x; i++) {
      int f = 0;
      while (x % i == 0) {
        f++;
        x /= i;
      }
      factor[i] = max(factor[i], f);
      if (x == 0) break;
    }
  }
  int64_t LCM = 1;
  for (auto f : factor) {
    for (int i = 0; i < (int)(f.second); i++) {
      LCM *= f.first;
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(N); i++) ans += (LCM - 1) % a.at(i);
  cout << ans << endl;
}
