#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) {
    return max(a, b);
  } else if (a % b == 0 || b % a == 0) {
    return min(a, b);
  }
  long long q;
  bool pro = true;
  while (pro) {
    q = a % b;
    a = b;
    b = q;
    if (a % b == 0) {
      return q;
      pro = false;
    }
  }
}
long long lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return (a * b) / g;
}
int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  ll go;
  cin >> a.at(0);
  go = a.at(0);
  for (int i = 1; i < N; i++) {
    cin >> a.at(i);
    go = lcm(go, a.at(i));
  }
  go--;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (go % a.at(i));
  }
  cout << ans << endl;
  return 0;
}
