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