#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m = 1;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[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;
}
