#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (signed i = 0; i < n; ++i) cin >> a[i];
  long long gcd = a[0];
  long long product = a[0];
  for (long long i = 1; i < n; ++i) product *= a[i];
  for (signed i = 0; i < n; ++i) {
    long long p = a[i];
    long long r = gcd;
    while (1) {
      if (p < r) swap(p, r);
      if (r == 0) break;
      if (p == r) break;
      p %= r;
    }
    gcd = p;
  }
  long long lcm = (product / gcd);
  long long m = lcm - 1;
  long long fm = 0;
  for (signed i = 0; i < n; ++i) {
    fm += (m % a[i]);
  }
  cout << fm;
  return 0;
}
