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