#include <bits/stdc++.h>   using namespace std;   const int dx[] = {-1, 0, 1, 0};   const int dy[] = {0, -1, 0, 1};   const int dx8[] = {-1, 0, 1, 0, 1, 1, -1, -1};   const int dy8[] = {0, -1, 0, 1, 1, -1, 1, -1};   void solve() {     long long n;     cin >> n;     vector<long long> a(n);     vector<vector<long long>> dp(n, vector<long long>(n));     vector<vector<long long>> sum(n, vector<long long>(n));     for (long long i = 0; i < n; i++) cin >> a[i];     sort(a.begin(), a.end());     vector<long long> s(n), l(n);     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < n; j++) {         if (a[i] >= 2 * a[j]) {           l[i] = j;           s[i]++;         }       }     }     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < n; j++) {         if (j == 0) {           dp[i][j] = 1;           long long x = i - 1 >= 0 ? sum[i - 1][j] : 0;           sum[i][j] = x + dp[i][j];           sum[i][j] %= 998244353;           continue;         }         if (s[i] - j + 1 > 0) {           dp[i][j] =               (dp[i][j - 1] * (s[i] - j + 1)) % 998244353 + sum[l[i]][j - 1];           dp[i][j] %= 998244353;         } else           dp[i][j] = 0;         long long x = i - 1 >= 0 ? sum[i - 1][j] : 0;         sum[i][j] = x + dp[i][j];         sum[i][j] %= 998244353;       }     }     cout << dp[n - 1][n - 1] <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     solve();   }   