#include <bits/stdc++.h>
const long long INF = 1e12;
long long gcd(long long a, long long b) {
  while (b > 0) {
    a = a % b;
    std::swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) {
  long long gcd_val = gcd(a, b);
  return a / gcd_val * b;
}
int main(int argc, char* argv[]) {
  long long N;
  std::cin >> N;
  std::vector<long long> va(N, 0);
  std::cin >> va[0];
  long long x = va[0];
  for (long long i = 1; i < N; i++) {
    std::cin >> va[i];
    x = lcm(x, va[i]);
  }
  long long m = x - 1;
  long long ans = 0;
  for (long long i = 0; i < N; i++) {
    ans += m % va[i];
  }
  std::cout << ans << std::endl;
  return 0;
}
