#include <bits/stdc++.h>
using namespace std;
int N;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return a == 0 ? b : gcd(b % a, a);
}
int main() {
  cin >> N;
  unsigned long long a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  unsigned long long last = a[0], cur = 0;
  for (int j = 1; j < N; j++) {
    cur = gcd(last, a[j]);
    last = (last / cur) * a[j];
  }
  unsigned long long sample = last - 1, sum = 0;
  for (int k = 0; k < N; k++) {
    sum += sample % a[k];
  }
  cout << sum << endl;
  return 0;
}
