#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  int c = 1;
  while (true) {
    if (max(a.at(0), a.at(1)) * c % min(a.at(0), a.at(1)) == 0) {
      m = max(a.at(0), a.at(1)) * c;
      break;
    }
    c++;
  }
  for (int i = 2; i < n; i++) {
    c = 1;
    while (true) {
      if (max(m, a.at(i)) * c % min(m, a.at(i)) == 0) {
        m = max(m, a.at(i)) * c;
        break;
      }
      c++;
    }
  }
  if (m >= 2) m--;
  long long int f = 0;
  for (int i = 0; i < n; i++) {
    f += m % a.at(i);
  }
  cout << f;
}
