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