#include <bits/stdc++.h>
const int INF = 1e9 + 7;
using namespace std;
long long gcd(long long n, long long r) {
  long long mod = n % r;
  if (mod == 0)
    return r;
  else
    return gcd(r, mod);
}
long long lcm(long long n, long long r) {
  long long gcd_v = gcd(n, r);
  return n / gcd_v * r;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long lcm_v = a[0];
  for (int i = 1; i < n; i++) {
    lcm_v = lcm(lcm_v, a[i]);
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += (lcm_v - 1) % a[i];
  }
  cout << res << endl;
  return 0;
}
