#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline ll lcm(T& a, T& b) {
  ll z = a * b;
  ll x = max(a, b);
  ll y = min(a, b);
  ll r = x % y;
  while (r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return z / y;
}
int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  ll m = a[0];
  for (int i = 0; i < (int)(N); i++) {
    m = lcm(m, a[i]);
  }
  m = m - 1;
  ll ans = 0;
  for (int i = 0; i < (int)(N); i++) {
    ans += m % a[i];
  }
  cout << ans << endl;
  return 0;
}
