#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T x, T y) {
  return y ? gcd(y, x % y) : x;
}
int main() {
  int N;
  cin >> N;
  vector<long long> y(N);
  cin >> y[0];
  long long m = y[0];
  for (int i = 1; i < N; ++i) {
    cin >> y[i];
    m = y[i] * m / gcd(y[i], m);
  }
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += (m - 1) % y[i];
  }
  cout << ans << endl;
  return 0;
}
