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