#include <bits/stdc++.h>
using namespace std;
const long MOD = 1e9 + 7;
int64_t gcd(int64_t m, int64_t n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
int64_t lcm(int64_t m, int64_t n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  int64_t n;
  priority_queue<int64_t> v;
  cin >> n;
  vector<int64_t> a(n, 0);
  vector<int64_t> b(n, 0);
  for (int64_t i = 0; i < n; i++) {
    cin >> a[i];
    v.push(a[i]);
  }
  for (int64_t i = n - 1; i >= 0; i--) {
    b[i] = v.top();
    v.pop();
  }
  long lcmnv = b[0];
  for (int64_t i = 1; i < n; i++) {
    lcmnv = lcm(lcmnv, b[i]);
  }
  lcmnv--;
  int64_t ans = 0;
  for (int64_t i = 0; i < n; i++) {
    ans += lcmnv % b[i];
  }
  cout << ans;
  return 0;
}
