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