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