#include <bits/stdc++.h>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (a < b) {
    unsigned long long tmp = a;
    a = b;
    b = tmp;
  }
  if (a % b)
    return gcd(b, a % b);
  else
    return b;
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return a * (b / gcd(a, b));
}
void sort_unique(vector<unsigned long long>& V) {
  sort(V.begin(), V.end());
  V.erase(unique(V.begin(), V.end()), V.end());
}
int main() {
  unsigned long long N;
  cin >> N;
  vector<unsigned long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  unsigned long long m = A[0];
  for (unsigned long long i = 1; i < A.size(); i++) {
    m = lcm(m, A[i]);
  }
  --m;
  unsigned long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (m % A[i]);
  }
  cout << ans << endl;
  ;
  return 0;
}
