#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, f = 0;
  long long m;
  long long a[3000];
  cin >> n;
  cin >> a[0];
  m = a[0];
  for (int i = 1; i < n; ++i) {
    cin >> a[i];
    m = m * a[i] / gcd(m, a[i]);
  }
  --m;
  for (int i = 0; i < n; ++i) {
    f += m % a[i];
  }
  cout << f << endl;
  return 0;
}
