#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
long long gcd(long long m, long long n) {
  long long temp;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}
long long lcm(long long m, long long n) { return m * n / gcd(m, n); }
void solve(long long N, std::vector<long long> a) {
  long long m = 0;
  for (int i = (0); i < (N); ++i) {
    m = max(m, a[i]);
  }
  long long f = 0;
  long long idx = 0;
  long long LCM = 1;
  for (int i = (0); i < (N); ++i) {
    LCM = lcm(a[i], LCM);
  }
  for (int i = (0); i < (N); ++i) {
    f += (LCM - 1) % a[i];
  }
  cout << f << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}
