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