#include <bits/stdc++.h>
int main() {
  int n, i;
  long tmp, g, x, y;
  scanf("%d", &n);
  long a[n];
  long c[n];
  long plus = 1;
  long ans = 0;
  scanf("%ld", &a[0]);
  c[0] = a[0];
  plus = a[0];
  for (i = 1; i < n; i++) {
    scanf("%ld", &a[i]);
    c[i] = a[i];
    x = plus * a[i];
    if (plus < a[i]) {
      tmp = plus;
      plus = a[i];
      a[i] = tmp;
    }
    g = plus % a[i];
    while (g != 0) {
      plus = a[i];
      a[i] = g;
      g = plus % a[i];
    }
    plus = x / a[i];
  }
  plus = plus - 1;
  for (i = 0; i < n; i++) {
    ans = ans + (plus % c[i]);
  }
  printf("%ld\n", ans);
  return 0;
}
