#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;
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;
}
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll m = a[0];
  for (int i = 1; i < n; i++) {
    m = lcm(m, a[i]);
  }
  m--;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += m % a[i];
  }
  cout << ans << endl;
  return 0;
}
