#include <bits/stdc++.h>
void swap(long long *x, long long *y) {
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(void) {
  int num;
  long long *a_n, *an;
  long long MCM = 0;
  scanf("%d", &num);
  a_n = (long long *)malloc(sizeof(long long) * num);
  an = (long long *)malloc(sizeof(long long) * num);
  long long i;
  long long A, r;
  for (i = 0; i < num; i++) {
    scanf("%lld", &a_n[i]);
    an[i] = a_n[i];
  }
  for (i = 0; i < num; i++) {
    if (i == 1) {
      A = a_n[0] * a_n[1];
      if (a_n[0] < a_n[1]) {
        swap(&a_n[0], &a_n[1]);
      }
      r = a_n[0] % a_n[1];
      while (r != 0) {
        a_n[0] = a_n[1];
        a_n[1] = r;
        r = a_n[0] % a_n[1];
      }
      MCM = A / a_n[1];
    } else if (i > 1) {
      A = MCM * a_n[i];
      if (MCM < a_n[i]) {
        swap(&MCM, &a_n[i]);
      }
      r = MCM % a_n[i];
      while (r != 0) {
        MCM = a_n[i];
        a_n[i] = r;
        r = MCM % a_n[i];
      }
      MCM = A / a_n[i];
    }
  }
  long long maxmod = 0;
  for (i = 0; i < num; i++) {
    maxmod += (MCM - 1) % an[i];
  }
  printf("%lld", maxmod);
  return 0;
}
