#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll lcm(ll x, ll y) {
  if (x < y) swap(x, y);
  ll r = x % y, xy = x * y;
  while (r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return xy / y;
}
int main() {
  int n;
  cin >> n;
  ll a[n];
  ll lcm_value = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    lcm_value = lcm(a[i], lcm_value);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (lcm_value - 1) % a[i];
  }
  cout << ans << endl;
}
