#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (true) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  int N;
  cin >> N;
  long long as[N];
  for (int i = (int)(0); i < (int)(N); ++i) {
    int a;
    cin >> a;
    as[i] = a;
  }
  long long final_lcm = as[0];
  for (int i = (int)(0); i < (int)(N); ++i) {
    final_lcm = lcm(final_lcm, as[i]);
  }
  int ans = 0;
  for (int i = (int)(0); i < (int)(N); ++i) {
    ans += (final_lcm - 1) % as[i];
  }
  cout << ans << endl;
  return 0;
}
