#include <bits/stdc++.h>
using namespace std;
int euclid(int a, int b) {
  if (a < b) {
    int cache = a;
    a = b;
    b = cache;
  }
  if (a % b == 0) {
    return b;
  }
  euclid(b, a % b);
  return -1;
}
int main() {
  int N;
  int a[3000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int current_GCD = 0;
  long long current_LCM = 0;
  current_GCD = euclid(a[0], a[1]);
  current_LCM = (a[0] * a[1]) / current_GCD;
  for (int i = 2; i < N; i++) {
    current_GCD = euclid(a[i], current_GCD);
    current_LCM = (current_LCM * a[i]) / current_GCD;
  }
  long long m = current_LCM - 1, sum = 0;
  for (int i = 0; i < N; i++) {
    sum += m % a[i];
  }
  cout << sum << endl;
}
