#include <bits/stdc++.h>
using namespace std;
uint64_t gcd(uint64_t u, uint64_t v) {
  while (v != 0) {
    uint64_t r = u % v;
    u = v;
    v = r;
  }
  return u;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<uint64_t> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  uint64_t x = 1;
  for (int i = 0; i < n; ++i) {
    x = a[i] / gcd(x, a[i]) * x;
  }
  uint64_t y = x - 1;
  uint64_t sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += y % a[i];
  }
  cout << sum << "\n";
}
