#include <bits/stdc++.h>
using namespace std;
long long int mins(vector<long long int> v) {
  long long int s;
  for (long long int a = 0; a < v.size() - 1; a++) {
    if ((v[a] % v[a + 1] == 0) || (v[a + 1] % v[a] == 0)) {
      if (v[a] > v[a + 1]) v[a + 1] = v[a];
    } else
      v[a + 1] = v[a] * v[a + 1];
  }
  return v[v.size() - 1];
}
int main() {
  long long int n, f, fmax = 0;
  scanf("%lld", &n);
  vector<long long int> va(n);
  for (long long int a = 0; a < n; a++) scanf("%lld", &va[a]);
  long long int m = mins(va) - 1;
  f = 0;
  for (long long int a = 0; a < n; a++) {
    f += m % va[a];
  }
  printf("%lld\n", f);
  return 0;
}
