#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll waz = 76543217;
void printVector(const vector<int>& vec) {
  for (int value : vec) {
    cout << value << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll N;
  cin >> N;
  vl a(N);
  for (ll i = 0; i < (ll)N; ++i) cin >> a[i];
  ll G = a[0];
  for (ll i = 1; i < (ll)N; ++i) {
    G = lcm(a[i], G);
  }
  ll ans = 0;
  for (ll i = 0; i < (ll)N; ++i) ans += (G - 1) % a[i];
  cout << ans << endl;
}
