#include <bits/stdc++.h>
int gcd(long int a, long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void multipleLCM(int A[], int i, int less, long int A0, long int *ans) {
  if (A[i + 1] == -1) {
    *ans = A0;
    return;
  }
  if (i + 1 != less) {
    int x = A0 * A[i + 1];
    A0 = gcd(A0, A[i + 1]);
    A0 = x / A0;
  }
  multipleLCM(A, i + 1, less, A0, ans);
}
int main() {
  int N, A[5000];
  long int ans, sum = 0;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  A[N] = -1;
  multipleLCM(A, 0, -1, A[0], &ans);
  ans -= 1;
  for (int i = 0; i < N; i++) {
    sum += ans % A[i];
  }
  printf("%ld\n", sum);
  return 0;
}
