#include <bits/stdc++.h>
intmax_t gcd(intmax_t m, intmax_t n) {
  while (n) std::swap(m %= n, n);
  return m;
}
int main() {
  size_t N;
  scanf("%zu", &N);
  std::vector<intmax_t> a(N);
  for (size_t i = 0; i < N; ++i) scanf("%jd", &a[i]);
  intmax_t x = a[0];
  for (size_t i = 1; i < N; ++i) {
    intmax_t g = gcd(x, a[i]);
    x = x / g * a[i];
  }
  intmax_t f = 0;
  for (size_t i = 0; i < N; ++i) f += (x - 1) % a[i];
  printf("%jd\n", f);
}
