#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, a, b;
  cin >> n;
  std::deque<long long int> deq;
  cin >> a;
  deq.emplace_back(a);
  for (long long int i = 0; i < n - 1; i++) {
    cin >> b;
    deq.emplace_back(b);
    long long int tmp_a = a;
    long long int tmp_b = b;
    if (b > a) {
      swap(a, b);
    }
    while (a % b != 0) {
      long long int tmp = b;
      b = a % b;
      a = tmp;
    }
    a = (tmp_a * tmp_b) / b;
  }
  long long int sum = 0;
  for (long long int j = 0; j < n; j++) {
    sum += (a - 1) % deq[j];
  }
  cout << sum << endl;
}
