#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll m = 1;
  vector<ll> v(n);
  for (int i = 0; i < (n); i++) {
    cin >> v[i];
    m = lcm(m, v[i]);
  }
  cerr << m << endl;
  ll ans = 0;
  for (int i = 0; i < (n); i++) ans += (m - 1) % v[i];
  cout << ans << '\n';
  return 0;
}
