#include <bits/stdc++.h>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  unsigned long long g = gcd(a, b);
  if (g > 0) {
    return a * b / g;
  }
  return 0;
}
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<unsigned long long> A(N);
  int i;
  for (i = 0; i < N; i++) {
    cin >> A[i];
  }
  unsigned long long X = A[0];
  unsigned long long Y;
  for (i = 1; i < N; i++) {
    Y = lcm(X, A[i]);
    X = Y;
  }
  Y--;
  unsigned long long F = 0;
  for (i = 0; i < N; i++) {
    F += Y % A[i];
  }
  cout << F << endl;
  return 0;
}
