#include <bits/stdc++.h>
long GCD(long a, long b) {
  long dividend, divisor;
  if (a >= b) {
    dividend = a;
    divisor = b;
  } else {
    dividend = b;
    divisor = a;
  }
  long remainder;
  while (1) {
    if (divisor == 1) {
      return 1;
    }
    remainder = dividend % divisor;
    if (remainder == 0) {
      break;
    } else {
      dividend = divisor;
      divisor = remainder;
    }
  }
  return divisor;
}
int main(void) {
  int n;
  scanf("%d", &n);
  long a[n];
  for (int i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  long lcm = a[0];
  for (int i = 1; i < n; i++) {
    lcm = lcm * a[i] / GCD(lcm, a[i]);
  }
  long m = lcm - 1;
  long sum = 0;
  for (int i = 0; i < n; i++) {
    sum += m % a[i];
  }
  printf("%ld\n", sum);
  return 0;
}
