#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
i64 gcd(i64 m, i64 n) { return (n == 0 ? m : gcd(n, m % n)); }
i64 lcm(i64 m, i64 n) { return m / gcd(m, n) * n; }
i64 func(i64 m, vector<i64> &v) {
  i64 res = 0;
  for (auto e : v) {
    res += m % e;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<i64> v;
  i64 m = 1;
  for (int i = 0; i < n; ++i) {
    i64 a;
    cin >> a;
    v.push_back(a);
    m = lcm(m, a);
  }
  cout << func(m - 1, v) << endl;
  return 0;
}
