#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 0x3f3f3f3f;
const int maxn = 5005;
const int mod = 998244353;
int n, a[maxn], pos[maxn];
int dp[maxn];
int jc[maxn], inv[maxn];
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
ll qp(ll a, ll b) {
  ll ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
ll A(ll x, ll y) { return 1LL * jc[x] * inv[x - y] % mod; }
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  jc[0] = 1;
  for (int i = 1; i <= n; i++) jc[i] = 1LL * jc[i - 1] * i % mod;
  inv[n] = qp(jc[n], mod - 2);
  for (int i = n - 1; i >= 0; i--) inv[i] = 1LL * inv[i + 1] * (i + 1) % mod;
  int j = 0;
  for (int i = 1; i <= n; i++) {
    while (j + 1 < i && 2 * a[j + 1] <= a[i]) j++;
    pos[i] = j;
  }
  if (pos[n] != n - 1) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = A(n - 1, pos[i]);
    for (int j = 1; j <= pos[i]; j++) {
      add(dp[i], 1LL * dp[j] * A(n - 2 - pos[j], pos[i] - pos[j] - 1) % mod);
    }
  }
  cout << dp[n] << "\n";
  return 0;
}
