#include <bits/stdc++.h>
int64_t calc_lcm(int64_t a, int64_t b) {
  int64_t small = std::min(a, b);
  int64_t big = std::max(a, b);
  while (big % small != 0) {
    int64_t mod = big % small;
    big = small;
    small = mod;
  }
  int64_t gcd = small;
  return a * b / gcd;
}
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t N;
  std::cin >> N;
  std::vector<int32_t> a(N);
  for (auto& i : a) {
    std::cin >> i;
  }
  int64_t lcm = a[0];
  for (int32_t i = 1; i < N; i++) {
    lcm = calc_lcm(lcm, (int64_t)a[i]);
  }
  int64_t mod = lcm - 1;
  int64_t sum = 0;
  for (int32_t i = 0; i < N; i++) {
    sum += mod % a[i];
  }
  std::cout << sum << std::endl;
  return 0;
}
