#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long v0 = a, v1 = b, v2 = a % b;
  while (v2 != 0) {
    v0 = v1;
    v1 = v2;
    v2 = v0 % v1;
  };
  return v1;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  int N;
  long long a[200010] = {}, b[200010] = {};
  cin >> N;
  for (long long i = (0); i < (N); i++) cin >> a[i];
  for (long long i = (0); i < (N); i++) b[i] = a[i];
  for (long long i = (0); i < (N - 1); i++) {
    a[i + 1] = lcm(a[i], a[i + 1]);
  }
  long long ans = 0;
  for (long long i = (0); i < (N); i++) ans += (a[N - 1] - 1) % b[i];
  cout << fixed << ans << endl;
  return 0;
}
