#include <bits/stdc++.h>
using namespace std;
int gcd(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
int lcm(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main(int argc, char const *argv[]) {
  int N, buf, LCM = 1;
  vector<int> a;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> buf;
    a.push_back(buf);
    LCM = lcm(buf, LCM);
  }
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += (LCM - 1) % a[i];
  }
  cout << sum << endl;
  return 0;
}
