#include <bits/stdc++.h>
using namespace std;
long long a[3001];
long long gcd(long long a, long long b) {
  long long temp;
  if (a < b) {
    temp = a;
    a = b;
    b = temp;
  }
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long lcm(long long m, long long n) { return (1LL * (m / gcd(m, n)) * n); }
int main(void) {
  int n;
  long long tmp, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  tmp = lcm(a[0], a[1]);
  for (int i = 2; i < n; i++) tmp = lcm(tmp, a[i]);
  for (int i = 0; i < n; i++) {
    ans += (tmp - 1) % a[i];
  }
  return !printf("%lld\n", ans);
}
