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