#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long a_lcm = a[0];
  for (int i = 1; i <= n - 1; ++i) a_lcm = lcm(a_lcm, (long long)a[i]);
  long long m = a_lcm - 1;
  long long ans = 0;
  for (int i = 0; i < n; ++i) ans += m % a[i];
  cout << ans << endl;
  return 0;
}
