#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  long long r = x % y;
  if (r == 0)
    return y;
  else
    return gcd(y, r);
}
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
long long lcm_all(vector<long long> &a) {
  if (a.size() == 2)
    return lcm(a[0], a[1]);
  else {
    vector<long long> b = a;
    b.erase(b.begin());
    return lcm(a[0], lcm_all(b));
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long m = lcm_all(a) - 1, ans = 0;
  for (long long i = 0; i < (n); i++) ans += m % a[i];
  cout << ans << endl;
  return 0;
}
