#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  return a * b / gcd(a, b);
}
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = (0); i < (int)(n); ++i) cin >> a[i];
  long long l = lcm(a[0], a[1]);
  for (int i = (0); i < (int)(n); ++i) l = lcm(l, a[i]);
  long long ans = 0;
  for (int i = (0); i < (int)(n); ++i) ans += (l - 1) % a[i];
  cout << ans << endl;
  return 0;
}
