#include <bits/stdc++.h>
using namespace std;
long long EuclidianAlgorithm(long long a, long long b) {
  long long m, n, temp;
  m = (a > b) ? a : b;
  n = (b > a) ? a : b;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}
int main() {
  int N;
  long long a[3000];
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  long long m = a[0];
  for (int i = 0; i < N - 1; ++i) {
    long long gcd = EuclidianAlgorithm(m, a[i + 1]);
    m = m * (a[i + 1] / gcd);
  }
  m -= 1;
  long long answer = 0;
  for (int i = 0; i < N; ++i) {
    answer += m % a[i];
  }
  cout << answer << endl;
}
