#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
int main(void) {
  long long N, r, ans = 0;
  long long a[3010], b[3010];
  cin >> N;
  for (long long(i) = 0; (i) < (N); (i)++) cin >> a[i];
  for (long long(i) = 0; (i) < (N); (i)++) b[i] = a[i];
  for (long long(i) = 0; (i) < (N - 1); (i)++) {
    b[i + 1] = LCM(b[i], b[i + 1]);
  }
  r = b[N - 1] - 1;
  for (long long(i) = 0; (i) < (N); (i)++) {
    ans += r % a[i];
  }
  cout << ans << endl;
  return 0;
}
