#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;
int GCD(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  return GCD(b, a % b);
}
int LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
  int n;
  ll a[3010];
  cin >> n;
  for (int i = (int)0; i < (int)n; ++i) cin >> a[i];
  ll m = a[0];
  for (int i = 1; i < n; i++) {
    m = LCM(m, a[i]);
  }
  m -= 1;
  ll ans = 0;
  for (int i = (int)0; i < (int)n; ++i) {
    ans += m % a[i];
  }
  cout << ans << endl;
  return 0;
}
