#include <bits/stdc++.h>
using namespace std;
const int MM = 1e9;
const int MOD = MM + 7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1};
template <typename T>
T GCD(T u, T v) {
  return v ? GCD(v, u % v) : u;
}
template <typename T>
T LCM(T x, T y) {
  T gc = GCD(x, y);
  return x * y / gc;
}
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  cin >> a[0];
  long long lcm = a[0];
  for (int i = 1; i < N; i++) {
    cin >> a[i];
    lcm = LCM(lcm, a[i]);
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (lcm - 1) % a[i];
  }
  cout << ans << endl;
}
