#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  for (auto& i : a) cin >> i;
  ll m = a[0];
  for (int i = 1; i < N; i++) {
    m = lcm(m, a[i]);
  }
  --m;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ans += m % a[i];
  }
  cout << ans << endl;
  return 0;
}
