#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r != 0) {
    long long tmp = r;
    r = b % r;
    b = tmp;
  }
  return b;
}
long long lcm(long long a, long long b) {
  if (a == b) {
    return a;
  } else if (a > b) {
    return (a * b) / gcd(a, b);
  } else {
    return (a * b) / gcd(b, a);
  }
  return b;
}
int main() {
  int N;
  cin >> N;
  vector<long long> an(N);
  for (int i = 0; i < N; i++) cin >> an[i];
  long long lcm_n = 1;
  for (auto ai : an) {
    lcm_n = lcm(lcm_n, ai);
  }
  long long m = lcm_n - 1;
  long long res = 0;
  for (auto ai : an) {
    res += m % ai;
  }
  cout << res << endl;
}
