#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  while (long long r = a % b) {
    a = b;
    b = r;
  }
  return b;
}
long long lcm(long long a, long long b) {
  long long kouyaku = gcd(a, b);
  long long koubai = floor((a * b) / kouyaku);
  return koubai;
}
int main(int argc, char **argv) {
  long long a;
  cin >> a;
  vector<long long> vec(a);
  for (long long i = 0; i < a; i++) {
    cin >> vec[i];
  }
  long long koubai = vec[0];
  for (long long i = 1; i < a; i++) {
    koubai = lcm(koubai, vec[i]);
  }
  koubai -= 1;
  long long mod = 0;
  for (long long i = 0; i < a; i++) {
    mod += (koubai % vec[i]);
  }
  cout << mod << endl;
  return 0;
}
