#include <bits/stdc++.h>
using namespace std;
long long a[3002];
long long gcd(long long l, long long r) {
  if (r == 0) {
    return l;
  }
  return gcd(r, l % r);
}
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long LMC = a[0];
  for (int i = 1; i < n; i++) {
    long long GCD = gcd(max(LMC, a[i]), min(LMC, a[i]));
    LMC = LMC / GCD * a[i];
  }
  LMC--;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += LMC % a[i];
  }
  cout << ans;
  return 0;
}
