#include <bits/stdc++.h>
using namespace std;
template <class T>
const bool is_impar(const T &x) {
  return (bool)(x & 1);
}
long long v[10005];
long long n;
long long cmmmcFin, rez;
long long cmmmc(long long a, long long b) {
  long long r;
  long long prod = a * b;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return prod / a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int(i) = (1); (i) < (int)(n + 1); (i) += (1)) cin >> v[i];
  cmmmcFin = v[1];
  for (int(i) = (2); (i) < (int)(n + 1); (i) += (1))
    cmmmcFin = cmmmc(cmmmcFin, v[i]);
  cmmmcFin--;
  for (int(i) = (1); (i) < (int)(n + 1); (i) += (1)) rez += (cmmmcFin % v[i]);
  cout << rez << "\n";
}
