#include <bits/stdc++.h>
#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getrnd(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rng); }
template <typename T1, typename T2>
inline bool relax(T1& a, const T2& b) {
  return a > b ? a = b, true : false;
}
template <typename T1, typename T2>
inline bool strain(T1& a, const T2& b) {
  return a < b ? a = b, true : false;
}
const int MOD = 998244353;
int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  if (a < 0) a += MOD;
  return a;
}
int mul(int a, int b) { return 1LL * a * b % MOD; }
int binpow(int a, ll n) {
  if (n < 0) a = binpow(a, MOD - 2), n *= -1;
  int res = 1;
  while (n) {
    if (n & 1) res = mul(res, a);
    a = mul(a, a);
    n /= 2;
  }
  return res;
}
int inv(int x) { return binpow(x, MOD - 2); }
const int N = 5003;
int dp[N][N], pref[N][N];
void solve() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  dp[0][0] = 1;
  for (int i = 0; i <= n; ++i) pref[0][i] = 1;
  for (int pos = 1; pos <= n; ++pos) {
    for (int lst = 1; lst <= n; ++lst) {
      int mxbef = upper_bound(a.begin(), a.end(), a[lst] / 2) - a.begin();
      int sad = mxbef - pos + 1;
      dp[pos][lst] = mul(dp[pos - 1][lst], max(0, sad));
      if (mxbef > 0) dp[pos][lst] = add(dp[pos][lst], pref[pos - 1][mxbef - 1]);
      pref[pos][lst] = add(pref[pos][lst - 1], dp[pos][lst]);
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i) ans = add(ans, dp[n][i]);
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(0));
  int t = 1;
  while (t--) solve();
  return 0;
}
