#include <bits/stdc++.h>
using ll = long long;
const int MOD = 998244353;
struct mint {
 public:
  int v;
  mint(int _v = 0) : v(_v) {
    if (v < -MOD || MOD <= v) v %= MOD;
    if (v < 0) v += MOD;
  }
  mint& operator+=(const mint& o) {
    if ((v += o.v) >= MOD) v -= MOD;
    return *this;
  }
  mint& operator-=(const mint& o) {
    if ((v -= o.v) < 0) v += MOD;
    return *this;
  }
  mint& operator*=(const mint& o) {
    v = (ll)v * o.v % MOD;
    return *this;
  }
  friend mint operator+(mint a, const mint& b) { return a += b; }
  friend mint operator-(mint a, const mint& b) { return a -= b; }
  friend mint operator*(mint a, const mint& b) { return a *= b; }
};
int main() {
  int N;
  scanf("%d", &N);
  mint inv[N + 1], F[2][N + 1];
  inv[1] = F[0][0] = F[1][0] = 1;
  for (int i = 2; i <= N; ++i) inv[i] = mint(MOD - MOD / i) * inv[MOD % i];
  for (int i = 1; i <= N; ++i)
    F[0][i] = F[0][i - 1] * mint(i), F[1][i] = F[1][i - 1] * inv[i];
  int a[N];
  for (int i = 0; i < N; ++i) scanf("%d", a + i);
  std::sort(a, a + N);
  int cnt[N];
  for (int i = 0, j = 0; i < N; ++i) {
    for (; j < i && a[j] * 2 <= a[i]; ++j)
      ;
    cnt[i] = j;
  }
  mint dp[N + 1][N + 1], p[N];
  dp[0][0] = mint(1);
  for (int i = 0, x = 0; i < N; ++i) {
    for (; x <= cnt[i]; ++x)
      for (int j = 0; j <= x; ++j) {
        p[j] *= mint(x - j);
        p[j] += dp[x][j] * F[0][x - j];
      }
    mint c;
    for (int j = 0; j <= cnt[i]; ++j)
      dp[i + 1][j + 1] = (c += p[j]) * F[1][cnt[i] - j];
  }
  printf("%d\n", dp[N][N]);
  return 0;
}
