#include <bits/stdc++.h>
using namespace std;
long long gcd(long long m, long long n) {
  long long tmp;
  while (m % n) {
    tmp = n;
    n = m % n;
    m = tmp;
  }
  return n;
}
long long lcm(long long m, long long n) { return m / gcd(m, n) * n; }
long long f(long long m, long long a[], long long n) {
  long long ret = 0;
  for (int i = 0; i < (n); ++i) ret += m % a[i];
  return ret;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long m = a[0];
  for (int i = 1; i < (n); ++i) m = lcm(m, a[i]);
  --m;
  cout << f(m, a, n) << endl;
}
