#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
const int MOD = 998244353;
int fac[MAXN], ifac[MAXN];
int n, dat[MAXN], f[MAXN], len[MAXN];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
inline void Add(int &x, int y) { x += y, x >= MOD && (x -= MOD); }
inline int qpow(int x, int y = MOD - 2) {
  long long r = 1, k = x;
  for (; y; y >>= 1) {
    if (y & 1) r *= k, r %= MOD;
    k *= k, k %= MOD;
  }
  return r;
}
inline void prepare() {
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % MOD;
  ifac[n] = qpow(fac[n]);
  for (int i = n - 1; ~i; i--) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % MOD;
}
inline int A(int n, int m) {
  if (n < 0 || m < 0 || n < m) return 0;
  return 1ll * fac[n] * ifac[n - m] % MOD;
}
int main() {
  n = read(), prepare();
  for (int i = 1; i <= n; i++) dat[i] = read();
  sort(dat + 1, dat + n + 1);
  if (dat[n] < dat[n - 1] * 2) {
    puts("0");
    return 0;
  }
  int lst = 0;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    while (dat[lst] * 2 <= dat[i] && lst <= n) lst++;
    len[i] = lst--;
    for (int j = 0; j <= lst; j++)
      Add(f[i], 1ll * f[j] * A(n - len[j] - 1, lst - len[j]) % MOD);
  }
  printf("%d\n", f[n]);
  return 0;
}
