#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll t = gcd(a, b);
  if (a % t == 0)
    return a / t * b;
  else if (b % t == 0)
    return b / t * a;
  else
    return a * b / t;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  cin >> a[0];
  ll l = a[0];
  for (ll i = 0; i < n - 1; i++) {
    cin >> a[i + 1];
    l = lcm(l, a[i + 1]);
  }
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ans += (l - 1) % a[i];
  }
  cout << ans << endl;
}
