#include <bits/stdc++.h>
using namespace std;
const int N = 5009, MOD = 998244353;
template <unsigned _MOD_>
struct modint {
  static const int MOD = _MOD_;
  int v;
  modint(int _v = 0) {
    v = _v % MOD;
    if (v < 0) v += MOD;
  }
  explicit operator int() const { return v; }
  static int mod_inv(int a) {
    int g = MOD, r = a, x = 0, y = 1;
    while (r != 0) {
      int q = g / r;
      g %= r;
      swap(g, r);
      x -= q * y;
      swap(x, y);
    }
    return x < 0 ? x + MOD : x;
  }
  modint &operator+=(const modint &other) {
    v += other.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }
  modint &operator-=(const modint &other) {
    v -= other.v;
    if (v < 0) v += MOD;
    return *this;
  }
  modint &operator*=(const modint &other) {
    v = ((uint64_t)v * other.v) % MOD;
    return *this;
  }
  modint &operator/=(const modint &other) { return *this *= other.inv(); }
  friend modint operator+(const modint &a, const modint &b) {
    return modint(a) += b;
  }
  friend modint operator-(const modint &a, const modint &b) {
    return modint(a) -= b;
  }
  friend modint operator*(const modint &a, const modint &b) {
    return modint(a) *= b;
  }
  friend modint operator/(const modint &a, const modint &b) {
    return modint(a) /= b;
  }
  modint &operator++() {
    v = v == MOD - 1 ? 0 : v + 1;
    return *this;
  }
  modint &operator--() {
    v = v == 0 ? MOD - 1 : v - 1;
    return *this;
  }
  modint operator++(int32_t) {
    modint before = *this;
    ++*this;
    return before;
  }
  modint operator--(int32_t) {
    modint before = *this;
    --*this;
    return before;
  }
  modint operator-() const { return v == 0 ? 0 : MOD - v; }
  bool operator==(const modint &other) const { return v == other.v; }
  bool operator!=(const modint &other) const { return v != other.v; }
  modint inv() const { return mod_inv(v); }
  modint pow(int p) const {
    modint a = *this, result = 1;
    while (p > 0) {
      if (p & 1) result *= a;
      a *= a;
      p >>= 1;
    }
    return result;
  }
  friend ostream &operator<<(ostream &out, const modint &m) {
    return out << m.v;
  }
};
using mint = modint<MOD>;
int n, a[N];
mint dp[N][N];
mint sm[N], ds[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    dp[i][1] = 1;
  }
  for (int i = 0; i < n; ++i) {
    int ct = upper_bound(a, a + n, a[i] / 2) - a;
    int up = lower_bound(a, a + n, a[i] * 2) - a;
    for (int j = 1; j <= n; ++j) {
      sm[j] += ds[j][i];
      dp[i][j] += sm[j];
      dp[i][j + 1] += dp[i][j] * (ct - j + 1);
      ds[j + 1][up] += dp[i][j];
    }
  }
  mint ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += dp[i][n];
  }
  cout << ans << '\n';
  return 0;
}
