#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
struct __INIT {
  __INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
template <class X>
X lcm(X a, X b) {
  X mm = a, nn = b, tmp;
  while (a % b != 0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return mm * nn / b;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  ll k = A[0];
  for (int i = 1; i < N; i++) {
    k = lcm(k, A[i]);
  }
  k--;
  ll sum = 0;
  for (int i = 0; i < N; i++) sum += k % A[i];
  cout << sum << endl;
}
