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