#include <bits/stdc++.h>
using namespace std;
long long LCM(long long a, long long b) {
  long long tempa = a;
  long long tempb = b;
  while (b != 0) {
    a %= b;
    if (a == 0) return tempb * tempa / b;
    b %= a;
  }
  return tempa * tempb / a;
}
int main() {
  long long N;
  cin >> N;
  long long a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long LCMG = a[0];
  for (int i = 1; i < N; i++) {
    LCMG = LCM(LCMG, a[i]);
  }
  long long total = 0;
  for (int i = 0; i < N; i++) {
    total = total + (LCMG - 1) % a[i];
  }
  cout << total << endl;
  return 0;
}
