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