#include <bits/stdc++.h>
long long lcm(long long a, long long b) {
  if (a < b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  long long r, x = a * b;
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x / b;
}
int main() {
  long long i, n, j, a[30001], hoge, ans = 0;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  hoge = lcm(a[0], a[1]);
  for (i = 2; i < n; i++) {
    hoge = lcm(hoge, a[i]);
  }
  hoge -= 1;
  for (i = 0; i < n; i++) {
    ans += hoge % a[i];
  }
  printf("%lld", ans);
  return 0;
}
