#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
const int MOD = (int)1e9 + 7;
const long long INF = 1LL << 60;
const int inf = 1 << 30;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& V) {
  int N = V.size();
  for (int i = 0; i < (N); i++) {
    os << V[i];
    if (i != N - 1) os << " ";
  }
  os << "\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T, T> const& P) {
  os << P.first;
  os << " ";
  os << P.second;
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& S) {
  auto it = S.begin();
  while (it != S.end()) {
    os << *it;
    os << " ";
    it++;
  }
  os << "\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T>& q) {
  for (auto it = q.begin(); it < q.end(); it++) {
    os << *it;
    os << " ";
  }
  os << endl;
  return os;
}
vector<pair<int, int>> dxdy = {make_pair(0, 1), make_pair(1, 0),
                               make_pair(-1, 0), make_pair(0, -1)};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long n, long long m) { return n * (m / gcd(n, m)); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
  }
  int ans = 0;
  long long lcm_num = A[0];
  for (int i = 0; i < (N); i++) {
    lcm_num = lcm(lcm_num, A[i]);
  }
  lcm_num--;
  for (int i = 0; i < (N); i++) {
    ans += lcm_num % A[i];
  }
  cout << ans << endl;
}
