#include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) {
  if (a < b) {
    return gcd(b, a);
  }
  while (a % b != 0) {
    long tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
long lcm(long a, long b) { return a * b / gcd(a, b); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long> as;
  for (int i = 0; i < N; ++i) {
    long tmp;
    cin >> tmp;
    as.push_back(tmp);
  }
  long m = as[0];
  for (int i = 1; i < N; ++i) {
    m = lcm(m, as[i]);
  }
  --m;
  long f = 0;
  for (auto &e : as) {
    f += m % e;
  }
  cout << f << endl;
  return 0;
}
