#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b > a)
    return gcd(b, a);
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  if (a > b) return lcm(b, a);
  return a / gcd(a, b) * b;
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long a[N];
  for (long long i = 0; i < N; i++) cin >> a[i];
  if (N == 1) {
    cout << a[0] << endl;
    return 0;
  }
  long long L = lcm(a[0], a[1]);
  for (long long i = 0; i < N - 2; i++) {
    L = lcm(L, a[i + 2]);
  }
  long long ans = 0;
  for (long long i = 0; i < N; i++) ans += (L - 1) % a[i];
  cout << ans << endl;
  return 0;
}
