#include <bits/stdc++.h>
using namespace std;
long gcm(long long a, long long b) {
  long long result = a;
  long long k = 0;
  long long n = b;
  do {
    k = result % n;
    result = n;
    n = k;
  } while (k != 0);
  return result;
}
long lcm(long long a, long long b) {
  long long g;
  g = gcm(a, b);
  return a * b / g;
}
int main() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long tmp = 0, ans = 0;
  tmp = A[0];
  for (int i = 1; i < N; i++) {
    tmp = lcm(tmp, A[i]);
  }
  tmp--;
  for (int i = 0; i < N; i++) {
    ans += tmp % A[i];
  }
  cout << ans << endl;
}
