#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a;
  a = 0;
  cin >> n;
  vector<int> v(n);
  cin >> v.at(0);
  m = v.at(0);
  for (int i = 1; i < n; i++) {
    cin >> v.at(i);
    int a = m;
    int b = v.at(i);
    int x = a * b;
    int r, tmp;
    if (a < b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    r = a % b;
    while (r != 0) {
      a = b;
      b = r;
      r = a % b;
    }
    m = x / b;
  }
  for (int i = 0; i < n; i++) {
    a += (m - 1) % (v.at(i));
  }
  cout << a << endl;
}
