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