#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
T gcd(const vector<T>& v) {
  T g = v[0];
  for (int i = (1); i < (static_cast<T>(v.size())); i++) g = gcd(g, v[i]);
  return g;
}
template <typename T>
T lcm(T a, T b) {
  T g = gcd(a, b);
  return g * (a / g) * (b / g);
}
template <typename T>
T lcm(const vector<T>& v) {
  T l = v[0];
  for (int i = (1); i < (static_cast<T>(v.size())); i++) l = lcm(l, v[i]);
  return l;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = (0); i < (n); i++) cin >> a[i];
  ll l = lcm(a);
  ll ans = 0;
  for (const auto& x : a) {
    ans += (l - 1) % x;
  }
  cout << ans << endl;
  return 0;
}
