#include <bits/stdc++.h>
using namespace std;
long long int lcm(long long int a, long long int b) {
  long long int x, tmp, r;
  x = a * b;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x / b;
}
int main() {
  long long int n, a, b;
  cin >> n;
  vector<long long int> num(n);
  for (int i = 0; i < n; ++i) {
    cin >> num[i];
  }
  sort((num).begin(), (num).end());
  a = num[0];
  b = num[1];
  for (int i = 2; i < n; ++i) {
    a = lcm(a, b);
    b = num[i];
  }
  a = lcm(a, b);
  long long int ans = 0;
  for (int i = 0; i < num.size(); ++i) {
    ans += (a - 1) % num[i];
  }
  cout << ans << endl;
  return 0;
}
