#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <typename T>
using V = vector<T>;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;
LL GCD(LL a, LL b) {
  LL t;
  LL r;
  if (a < b) {
    t = a;
    a = b;
    b = t;
  }
  if (b == 0) {
    return a;
  }
  while (a % b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return b;
}
LL LCM(LL a, LL b) {
  LL ab = (a * b);
  return ab / GCD(a % b, b);
}
LL f(Vll a, LL m) {
  LL sum_mod = 0;
  for (LL i : a) {
    sum_mod += m % i;
  }
  return sum_mod;
}
int main() {
  int N;
  cin >> N;
  Vll a(N);
  for (int(i) = 0; (i) < (N); (i)++) cin >> a[i];
  LL a_lcm = 1;
  for (int(i) = 0; (i) < (N); (i)++) a_lcm = LCM(a_lcm, a[i]);
  cout << f(a, a_lcm - 1) << endl;
  return 0;
}
