#include <bits/stdc++.h>
using namespace std;
int n;
const int max_n = 10000;
long long a[max_n];
long long gcd(long long s, long long t) {
  if (t == 0) return s;
  return gcd(t, s % t);
}
void solve() {
  long long lcm = a[0];
  for (int i = 1; i < n; i++) {
    long long gcds = gcd(lcm, a[i]);
    lcm = (lcm / gcds) * a[i];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (lcm - 1) % a[i];
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}
