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