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