#include <bits/stdc++.h>
using namespace std;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vc<vc<T>>;
template <class T>
void mkuni(vector<T>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
long long rand_int(long long l, long long r) {
  static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<long long>(l, r)(gen);
}
template <class T>
void print(T x, int suc = 1) {
  cout << x;
  if (suc == 1)
    cout << '\n';
  else
    cout << ' ';
}
template <class T>
void print(const vector<T>& v, int suc = 1) {
  for (int i = 0; i < v.size(); i++)
    print(v[i], i == (int)(v.size()) - 1 ? suc : 2);
}
const int INF = 0x3f3f3f;
const int maxn = 5e3 + 7;
const int mod = 998244353;
const int N = 1e7 + 7;
int n;
int dp[maxn][maxn];
int pre[maxn];
int sum[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    pre[i + 1] = upper_bound(a.begin(), a.end(), (a[i]) / 2) - a.begin();
  }
  dp[0][n + 1] = 1;
  for (int i = 0; i < n; ++i) {
    sum[n + 1] = dp[i][n + 1];
    for (int k = n; k >= 1; --k) sum[k] = (sum[k + 1] + dp[i][k]) % mod;
    for (int j = 1; j <= n; ++j) {
      if (pre[n - j + 1] - i + 1 >= 0)
        dp[i + 1][j] =
            (dp[i + 1][j] + 1ll * dp[i][j] * (pre[n - j + 1] - i + 1) % mod) %
            mod;
      dp[i + 1][j] = (dp[i + 1][j] + sum[n - pre[n - j + 1] + 1]) % mod;
    }
  }
  cout << dp[n][1] << '\n';
  return 0;
}
