#include <bits/stdc++.h>
using namespace std;
long long Gcd(long long m, long long n) {
  long long temp;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}
long long Lcm(long long m, long long n) { return m * n / Gcd(m, n); }
long long multiLcm(vector<long long> v) {
  if (v.size() == 1) {
    return v[0];
  }
  long long a, b, c;
  a = v.back();
  v.pop_back();
  b = v.back();
  v.pop_back();
  c = Lcm(a, b);
  v.push_back(c);
  long long res = multiLcm(v);
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long n = multiLcm(a);
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (n - 1) % a[i];
  }
  cout << ans << endl;
  return 0;
}
