#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < (long long)n; i++) {
    cin >> a[i];
  }
  long long gcd = 1;
  for (long long i = 1; i <= 100000; i++) {
    bool fl = true;
    for (long long j = 0; j < (long long)n; j++) {
      if (a[j] % i != 0) fl = false;
    }
    if (fl) gcd = i;
  }
  long long LCM = gcd;
  for (long long i = 0; i < (long long)n; i++) {
    LCM *= a[i] / gcd;
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)n; i++) {
    ans += (LCM - 1) % a[i];
  }
  cout << ans << endl;
  return 0;
}
