#include <bits/stdc++.h>
long long n, tmp = 1, ans = 0;
long long a[3010];
long long read() {
  long long ret, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -1);
  for (ret = ch - '0'; isdigit(ch = getchar()); ret *= 10, ret += ch - '0')
    ;
  return ret * f;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
signed main() {
  n = read();
  for (long long i = 1; i <= n; ++i) a[i] = read();
  for (long long i = 1; i <= n; ++i) tmp = lcm(tmp, a[i]);
  --tmp;
  for (long long i = 1; i <= n; ++i) ans += tmp % a[i];
  print(ans);
}
