#include <bits/stdc++.h>

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<ll> A(N);
  ll l = 1ll;
  REP(i, N) {
    cin >> A.at(i);
    l = lcm(A.at(i), l);
  }
  ll m = l - 1;

  ll ans = 0;
  REP(i, N) { ans += m % A.at(i); }
  cout << ans << endl;

  return 0;
}
