#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005, MOD = 998244353;
long long dp[MAXN][MAXN], fact[MAXN], invfact[MAXN], inv[MAXN], a[MAXN];
int n, t[MAXN], nxt[MAXN];
long long inverse(long long a) {
  int b = MOD - 2;
  long long res = 1;
  for (b; b; b /= 2) {
    if (b % 2) res *= a, res %= MOD;
    a *= a;
    a %= MOD;
  }
  return res;
}
int main() {
  fact[0] = 1;
  invfact[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    invfact[i] = inverse(fact[i]);
  }
  for (int i = 1; i < MAXN; i++) inv[i] = inverse(i);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    for (int j = i - 1; j >= 0; j--)
      if (a[j] * 2 <= a[i]) {
        t[i] = j + 1;
        break;
      }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (a[i] * 2 <= a[j]) {
        nxt[i] = j;
        break;
      }
  if (t[n - 1] != n - 1) return cout << 0, 0;
  for (int j = 0; j <= n - 1; j++) dp[n - 1][j] = fact[n - 1 - j];
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j <= t[i]; j++)
      dp[i][0] +=
          dp[nxt[i]][j + 1] * fact[t[i]] % MOD * invfact[t[i] - j] % MOD,
          dp[i][0] %= MOD;
    for (int j = 1; j <= t[i]; j++)
      dp[i][j] = (dp[i][j - 1] - dp[nxt[i]][j]) * inv[t[i] - j + 1] % MOD;
    for (int j = 0; j < MAXN; j++) dp[i][j] += dp[i + 1][j], dp[i][j] %= MOD;
  }
  cout << (dp[0][0] + MOD) % MOD;
}
