#include <bits/stdc++.h>
static long Gcd(long m, long n) {
  long temp;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}
static long Lcm(long m, long n) { return m * n / Gcd(m, n); }
int main(void) {
  int N, a[4000], big = 0, x, tmp, r, w, b, i = 0;
  long A[4000], m, mod;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    A[i] = a[i];
  }
  for (i = 0; i < N - 1; i++) {
    A[i + 1] = Lcm(A[i], A[i + 1]);
  }
  m = A[N - 1];
  for (i = 0; i < N; i++) {
    mod += (m - 1) % a[i];
  }
  printf("%d", mod);
  return 0;
}
