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