#include <bits/stdc++.h>
using namespace std;
template <class It>
string join(It i1, It i2) {
  ostringstream ss;
  for (auto it = i1; it != i2; ++it) ss << ((it == i1) ? "" : ", ") << (*it);
  return ss.str();
}
bool is_prime(size_t n) {
  if (n % 2 == 0) return false;
  ;
  int r = (int)sqrt(n);
  for (int i = 3; i <= r; i += 2)
    if (n % i == 0) return false;
  return true;
}
int main() {
  int N;
  cin >> N;
  vector<size_t> A(N);
  for (auto &a : A) cin >> a;
  vector<size_t> P({2, 3, 5, 7, 9, 11, 13});
  auto a_max = *max_element(A.begin(), A.end());
  for (int i = 14; i < a_max; ++i)
    if (is_prime(i)) P.push_back(i);
  size_t m(1);
  for (auto a : A) {
    size_t x = m;
    for (auto p : P) {
      while (x % p == 0 && a % p == 0) {
        x /= p;
        a /= p;
      }
    }
    m *= a;
  };
  size_t s(0);
  for (auto a : A) s += (m - 1) % a;
  cout << s << endl;
}
