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