#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll ans = (a[0] * a[1]) / gcd(a[0], a[1]);
  for (ll i = 2; i < n; i++) {
    ans = (ans * a[i]) / gcd(a[i], ans);
  }
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    sum += (ans - 1) % a[i];
  }
  cout << sum << endl;
}
