#include <bits/stdc++.h>
using namespace std;
long long gcd(long long t1, long long t2) {
  if (t2 == 0) return t1;
  return gcd(t2, t1 % t2);
}
long long lcm(long a, long b) {
  long long lcm = gcd(a, b);
  return a / lcm * b;
}
int main() {
  int n;
  cin >> n;
  int a[3001];
  long long ans = 1LL;
  long long cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans = lcm(ans, a[i]);
  }
  for (int i = 0; i < n; i++) {
    cnt += (ans - 1) % a[i];
  }
  cout << cnt << endl;
  return 0;
}
