#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long m = (a[0] * a[1]) / gcd(a[0], a[1]);
  for (int i = 2; i < N; i++) {
    m = (m * a[i]) / gcd(m, a[i]);
  }
  long long f = 0;
  for (int i = 0; i < N; i++) {
    f += (m - 1) % a[i];
  }
  cout << f << endl;
  return 0;
}
