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