#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long t;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long s = a[0], z = a[1], r;
  long long x = a[0];
  for (long long i = 0; i < n - 1; i++) {
    if (s < z) {
      t = s;
      s = z;
      z = t;
    }
    r = s % z;
    while (r != 0) {
      s = z;
      z = r;
      r = s % z;
    }
    x = x * a[i + 1] / z;
    s = x;
    z = a[i + 2];
  }
  for (long long i = 0; i < n; i++) {
    sum += (x - 1) % a[i];
  }
  cout << sum << endl;
  system("pause");
  return 0;
}
