#include <bits/stdc++.h>
using namespace std;
long long gcd_mod(long long a, long long b) {
  if (b == 0) return a;
  return gcd_mod(b, a % b);
}
long long lgm(long long a, long long b) { return (a * b) / gcd_mod(a, b); }
void c_modulo_summation(void) {
  int n;
  cin >> n;
  vector<long long> a(n + 1);
  long long lgm_val;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n - 1; i++) {
    if (i == 1) {
      lgm_val = lgm(a[i], a[i + 1]);
    } else {
      lgm_val = lgm(lgm_val, a[i + 1]);
    }
  }
  long long sum = 0;
  lgm_val--;
  for (int i = 1; i <= n; i++) {
    sum += (lgm_val % a[i]);
  }
  cout << sum << endl;
}
int main() {
  c_modulo_summation();
  return 0;
}
