#include <bits/stdc++.h>
int getLCM(int m, int n) {
  int c, pm = m, pn = n;
  if (m < n) {
    c = m;
    m = n;
    n = c;
  }
  while (n > 0) {
    c = n;
    n = m % n;
    m = c;
  }
  return pm * pn / m;
}
int main(void) {
  int n, i, f = 0, lcm = 1;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    lcm = getLCM(lcm, a[i]);
  }
  for (i = 0; i < n; i++) {
    f += (lcm - 1) % a[i];
  }
  printf("%d\n", f);
  return 0;
}
