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