#include <bits/stdc++.h>
using namespace std;
long long lcm(long long a, long long b) {
  long long r;
  long long tmp;
  long long x;
  x = a * b;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x / b;
}
int main(int argc, char *argv[]) {
  int i;
  int N;
  cin >> N;
  long long a[N];
  long long temp_res;
  long long sum = 0;
  for (i = 0; i < N; i++) {
    cin >> a[i];
  }
  temp_res = lcm(a[0], a[1]);
  for (i = 2; i < N; i++) {
    temp_res = lcm(temp_res, a[i]);
  }
  for (i = 0; i < N; i++) {
    sum += (temp_res - 1) % a[i];
  }
  cout << sum << "\n";
  return 0;
}
