#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  int N;
  set<long long> st;
  vector<long long> A;
  long long m = 1;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
    st.insert(a);
  }
  long long ans = 0;
  for (auto itr = st.begin(); itr != st.end(); ++itr) {
    m = lcm(m, *itr);
  }
  for (int i = 0; i < N; i++) {
    ans += (m - 1) % A[i];
  }
  cout << ans << endl;
  return 0;
}
