#include <bits/stdc++.h>
using namespace std;
template <typename TypeInt>
TypeInt G_C_D(TypeInt a, TypeInt b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (b != 0) {
    a %= b;
    if (a == 0) return b;
    b %= a;
  }
  return a;
}
template <typename TypeInt>
TypeInt G_C_D(const std::vector<TypeInt> &list) {
  if (list.size() < 2) throw "内容が1以下\n";
  TypeInt a = list[0];
  for (size_t i = 1; i < list.size(); ++i) {
    a = G_C_D(a, list[i]);
  }
  return a;
}
template <typename TypeInt>
TypeInt L_C_M(TypeInt a, TypeInt b) {
  if (a == 0 && b == 0) return 0;
  return a / G_C_D(a, b) * b;
}
template <typename TypeInt>
TypeInt L_C_M(const std::vector<TypeInt> &list) {
  if (list.size() < 2) throw "内容が1以下\n";
  TypeInt a = list[0];
  for (size_t i = 1; i < list.size(); ++i) {
    a = L_C_M(a, list[i]);
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  vector<long long> vec(n);
  vector<long long> ved(n);
  for (long long i = 0; i < n; ++i) {
    cin >> vec[i];
    ved[i] = vec[i];
  }
  for (long long i = 0; i < n - 1; ++i) {
    ved[i + 1] = L_C_M(ved[i], vec[i + 1]);
  }
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    ans += (ved[n - 1] - 1) % vec[i];
  }
  cout << ans << endl;
}
