#include <bits/stdc++.h>
int gcd(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
int lcm(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main(void) {
  long long max = 0, sum = 0, maxa = 0, res;
  int n;
  int a[100000];
  scanf("%d", &n);
  int lcm1 = 1;
  for (int i = 0; i < n; i++) {
    scanf(" %d", &a[i]);
    lcm1 = lcm(lcm1, a[i]);
  }
  for (int i = 0; i < n; i++) {
    sum += (lcm1 - 1) % a[i];
  }
  printf("%lld\n", sum);
  return 0;
}
