#include <bits/stdc++.h>   const long long mod = 998244353;   const int kN = 5e3 + 10;   int n, a[kN], lim[kN];   long long f[kN], fac[kN], invfac[kN];   inline int read() {     int f = 1, w = 0;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = -1;     for (; isdigit(ch); ch = getchar()) {       w = (w << 3) + (w << 1) + (ch ^  0 );     }     return f * w;   }   void Chkmax(int &fir_, int sec_) {     if (sec_ > fir_) fir_ = sec_;   }   void Chkmin(int &fir_, int sec_) {     if (sec_ < fir_) fir_ = sec_;   }   long long QPow(long long x_, long long y_) {     x_ %= mod;     long long ret = 1;     for (; y_; y_ >>= 1ll) {       if (y_ & 1) ret = ret * x_ % mod;       x_ = x_ * x_ % mod;     }     return ret;   }   long long A(long long n_, long long m_) {     if (n_ < 0 || m_ < 0 || m_ > n_) return 0;     return 1ll * fac[n_] * invfac[n_ - m_] % mod;   }   void Prepare() {     n = read();     invfac[0] = fac[0] = 1;     for (int i = 1; i <= n; ++i) {       a[i] = read();       fac[i] = 1ll * fac[i - 1] * i % mod;       invfac[i] = QPow(fac[i], mod - 2);     }     std::sort(a + 1, a + n + 1);     for (int i = 1, j = 0; i <= n; ++i) {       while (j <= n && 2ll * a[j] <= 1ll * a[i]) ++j;       --j;       lim[i] = j;     }   }   int main() {     Prepare();     if (lim[n] != n - 1) {       printf( 0 n );       return 0;     }     f[0] = 1, lim[0] = -1;     for (int i = 1; i <= n; ++i) {       for (int j = 0; j <= lim[i]; ++j) {         f[i] += 1ll * f[j] *                 A(1ll * n - 2ll - lim[j], 1ll * lim[i] - lim[j] - 1ll) % mod;         f[i] %= mod;       }     }     printf( %lld n , f[n]);     return 0;   }   