#include <bits/stdc++.h>
int main(void) {
  int N, i, j, b, c, d, e, f = 0, r, k;
  int a[3000];
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d", &a[i]);
  d = a[0];
  for (j = 1; j < N; j++) {
    e = d;
    r = a[j];
    while (r != 0) {
      c = b % r;
      b = r;
      r = c;
    }
    d = a[j] / b * e;
  }
  for (k = 0; k < N; k++) f = f + (e - 1) % a[k];
  printf("%d\n", f);
  return 0;
}
