#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return b / gcd(b, a % b) * a; }
int main() {
  long long n, d, ans = 0, LCM = 1;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i], LCM = lcm(LCM, a[i]);
  for (int i = 0; i < (n); i++) ans += (LCM - 1) % a[i];
  cout << ans << endl;
  return 0;
}
