#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  ll g = gcd(a, b);
  return a / g * b;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int(i) = 0; (i) < (n); ++(i)) cin >> a[i];
  ll l = 1;
  for (int(i) = 0; (i) < (n); ++(i)) l = lcm(l, a[i]);
  l--;
  ll ans = 0;
  for (int(i) = 0; (i) < (n); ++(i)) ans += l % a[i];
  cout << ans << endl;
}
