#include <bits/stdc++.h>
using namespace std;
template <typename T>
using vec = vector<T>;
template <typename T>
using heap = priority_queue<T>;
template <typename T>
using minheap = priority_queue<T, vec<T>, greater<T>>;
using ll = long long;
using str = string;
using vi = vec<ll>;
using vvi = vec<vi>;
using vs = vec<str>;
using vb = vec<bool>;
using pii = pair<ll, ll>;
using vp = vec<pii>;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
bool isPrime(ll n) {
  if (n < 2) return false;
  for (ll i = (2); i < (ll)((sqrt(n) + 1)); i += (1)) {
    if (n % i == 0) return false;
  }
  return true;
}
void eratosthenes(vb& primes) {
  for (ll i = (0); i < (ll)(((ll)(primes).size())); i += (1)) primes[i] = true;
  primes[0] = primes[1] = false;
  for (ll i = (0); i < (ll)(((ll)(primes).size()) / 2 + 1); i += (1)) {
    if (primes[i]) {
      for (ll j = (i + i); j < (ll)(((ll)(primes).size())); j += (i))
        primes[j] = false;
    }
  }
}
inline ll minMultiple(ll a, ll n) { return n * (a / n + (a % n == 0 ? 0 : 1)); }
vi listDivisors(ll n) {
  vi divs;
  for (ll i = (1); i < (ll)(sqrt(n) + 1); i += (1)) {
    if (n % i == 0) {
      divs.push_back(i);
      divs.push_back(n / i);
    }
  }
  sort((divs).begin(), (divs).end());
  return divs;
}
map<ll, ll> primeFactorize(ll n) {
  map<ll, ll> prime_factors;
  ll m = n;
  for (ll i = (2); i < (ll)(sqrt(n) + 1); i += (1)) {
    if (m < 1) break;
    while (m % i == 0) {
      ++prime_factors[i];
      m /= i;
    }
  }
  if (m != 1) ++prime_factors[m];
  return prime_factors;
}
inline ll mod_add(ll a, ll b) { return (a + b) % MOD; }
inline ll mod_sub(ll a, ll b) { return (a + MOD - b) % MOD; }
inline ll mod_mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll mod_pow(ll x, ll y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x % MOD;
  else if (y % 2 == 0) {
    ll val = mod_pow(x, (ll)(y / 2));
    return mod_mul(val, val);
  } else {
    ll val = mod_pow(x, (ll)(y / 2));
    return mod_mul(mod_mul(val, val), x);
  }
}
ll mod_inv(ll x) { return mod_pow(x, MOD - 2); }
ll mod_div(ll a, ll b) { return mod_mul(a, mod_inv(b)); }
ll fact(ll n) { return n == 0 ? 1 : mod_mul(n, fact(n - 1)); }
ll comb(ll n, ll r) { return fact(n) / fact(n - r) / fact(r); }
template <typename T>
inline bool chmax(T& a, const T b) {
  if (a < b) a = b;
  return a < b;
}
template <typename T>
inline bool chmin(T& a, const T b) {
  if (a > b) a = b;
  return a > b;
}
template <typename T = ll>
inline T in() {
  T x;
  cin >> x;
  return x;
}
template <typename T>
inline void print(const T& x) {
  cout << x << "\n";
}
template <typename T>
inline void print(const vector<T>& v) {
  for (ll i = (0); i < (ll)(((ll)(v).size())); i += (1))
    cout << v[i] << (i != ((ll)(v).size()) - 1 ? " " : "\n");
}
template <typename T>
inline void print(const vector<vector<T>>& vv) {
  for (ll j = (0); j < (ll)(((ll)(vv).size())); j += (1)) print(vv[j]);
}
template <typename T, typename U>
inline void print(const pair<T, U>& p) {
  cout << p.first << " " << p.second << "\n";
}
template <typename T, typename U>
inline void print(const vector<pair<T, U>>& vp) {
  for (ll i = (0); i < (ll)(((ll)(vp).size())); i += (1)) print(vp[i]);
}
template <typename T, typename U>
inline void print(const map<T, U>& d) {
  for (auto&& x : d) print(x);
}
struct Init {
  Init() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  }
} init;
int main() {
  ll N = in();
  vi A(N);
  for (ll i = (0); i < (ll)(N); i += (1)) A[i] = in();
  ll LCM = lcm(A[0], A[1]);
  for (ll i = (2); i < (ll)(N); i += (1)) LCM = lcm(LCM, A[i]);
  --LCM;
  ll ans = 0;
  for (ll i = (0); i < (ll)(N); i += (1)) ans += LCM % A[i];
  print(ans);
}
