#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 a, long long b) {
  long long tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  int N;
  long long a[3000];
  cin >> N;
  for (int i = (0); i < (N); ++i) cin >> a[i];
  long long m = a[0] * a[1] / gcd(a[0], a[1]);
  long long ans = 0;
  for (int i = 2; i < N; i++) {
    m = m * a[i] / gcd(m, a[i]);
  }
  for (int i = 0; i < N; i++) {
    ans += (m - 1) % a[i];
  }
  cout << ans << endl;
  return 0;
}
