#include <bits/stdc++.h>
using namespace std;
long gcd(long m, long a) {
  long r = m % a;
  if (r == 0)
    return a;
  else
    return gcd(a, r);
}
int main(void) {
  vector<int> a;
  int n, box;
  long res = 0, m = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> box;
    a.push_back(box);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = n - 1; i >= 0; i--) {
    if (m == 1) {
      m = a[i];
    } else if (m % a[i] == 0) {
      continue;
    } else {
      m = m * a[i] / gcd(m, (long)a[i]);
    }
  }
  m--;
  for (int i = 0; i < n; i++) {
    res += m % a[i];
  }
  cout << res << endl;
  return 0;
}
