#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r = a % b;
  if (r == 0) {
    return b;
  } else {
    return gcd(b, r);
  }
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort((v).begin(), (v).end());
  reverse(v.begin(), v.end());
  long long l = v[0];
  for (long long i = 1; i < n; i++) {
    l = lcm(l, v[i]);
  }
  l--;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += (l % v[i]);
  }
  cout << ans << endl;
}
