#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll lcm(ll a, ll b) {
  int r;
  while ((r = a % b) != 0) {
    a = b;
    b = r;
  }
  return b;
}
ll gcd(ll a, ll b) { return (a * b) / lcm(a, b); }
int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = (int)(0); i < (int)(n); ++i) cin >> l[i];
  ll s = 1;
  for (const auto& x : (l)) {
    s = gcd(x, s);
  }
  --s;
  ll sum = 0;
  for (const auto& x : (l)) {
    sum += (s % x);
  }
  cout << sum << endl;
}
