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