#include <bits/stdc++.h>
using namespace std;
const int maxn = 6000;
const int mod = 998244353;
int a[maxn], lim[maxn], f[maxn], n;
int fac[maxn + 1], ifac[maxn + 1];
int Pow(int a, int x) {
  int res = 1;
  for (; x; x >>= 1, a = 1ll * a * a % mod)
    if (x & 1) res = 1ll * res * a % mod;
  return res;
}
void math_init() {
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  ifac[n] = Pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
}
int A(int u, int v) {
  if (u < 0 || v < 0 || v > u) return 0;
  return 1ll * fac[u] * ifac[u - v] % mod;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  math_init();
  int F = n;
  lim[1] = 0;
  lim[0] = -1;
  for (int i = n; i >= 2; i--) {
    while (F > 0 && F >= i) --F;
    while (F > 0 && a[F] * 2 > a[i]) F--;
    lim[i] = F;
  }
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int j = 0; j <= lim[i]; j++) {
      ans = (1ll * ans + 1ll * f[j] * A(n - 2 - lim[j], lim[i] - lim[j] - 1)) %
            mod;
    }
    f[i] = ans;
  }
  if (lim[n] == n - 1) {
    printf("%d\n", f[n]);
  } else {
    printf("0\n");
  }
}
