#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
int main() {
  int N;
  cin >> N;
  vector<ull> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  ull m = 1;
  for (ull a : A) m = lcm(m, a);
  m--;
  ll ans = 0;
  for (ull a : A) ans += m % a;
  cout << ans << endl;
}
