#include <bits/stdc++.h>
using namespace std;
string ans_Yes = "Yes";
string ans_No = "No";
string ans_yes = "yes";
string ans_no = "no";
long long getKoyaku(long long a, long long b) {
  long long r, tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  int N;
  cin >> N;
  vector<int> val;
  int tmp;
  for (int ni = 0; ni < N; ni++) {
    cin >> tmp;
    val.push_back(tmp);
  }
  sort(val.begin(), val.end());
  long long kobai = 1;
  for (int ni = 0; ni < N; ni++) {
    kobai = kobai * val[ni] / getKoyaku(kobai, val[ni]);
  }
  long long ans = 0;
  for (int ni = 0; ni < N; ni++) {
    ans += (kobai - 1) % val[ni];
  }
  cout << ans << endl;
}
