#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long a[N];
  for (int i = 0; i < N; ++i) cin >> a[i];
  long long sum = 0;
  long long m;
  long long sm, la, work;
  m = a[0];
  for (int i = 0; i < N - 1; ++i) {
    if (m < a[i + 1]) {
      la = a[i + 1];
      sm = m;
    } else {
      la = m;
      sm = a[i + 1];
    }
    while (1) {
      work = la % sm;
      if (work == 0) break;
      la = sm;
      sm = work;
    }
    m = m * a[i + 1] / sm;
  }
  m = m - 1;
  for (int i = 0; i < N; ++i) sum += m % a[i];
  cout << sum << endl;
  return 0;
}
