#include <bits/stdc++.h>
using namespace std;
long long gcd(long long m, long long n) {
  while (n != 0LL) {
    long long r = m % n;
    m = n;
    n = r;
  }
  return m;
}
long long lcm(long long m, long long n) { return m / gcd(m, n) * n; }
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  long long cand = 1LL;
  for (int i = 0; i < (int)(N); i++) {
    cand = lcm(cand, a[i]);
  }
  cand--;
  long long ans = 0;
  for (int j = 0; j < (int)(N); j++) ans += cand % a[j];
  cout << ans << endl;
  return 0;
}
