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