#include <bits/stdc++.h>
using namespace std;
long long lcm(long long a, long long b) {
  if (a < b) {
    long long temp = a;
    a = b;
    b = temp;
  }
  long long x = a * b;
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x / b;
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long lcm_v = A[0];
  for (int i = 1; i < A.size(); i++) {
    lcm_v = lcm(lcm_v, (long long)A[i]);
  }
  lcm_v--;
  int ans = 0;
  for (int i = 0; i < A.size(); i++) {
    ans += lcm_v % A[i];
  }
  cout << ans << endl;
  return 0;
}
