#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long pow(long long a, long long n) {
  if (n == 0) return 1;
  if (n == 1) return (a % MOD);
  long long squareRoot = pow(a, n / 2);
  squareRoot = (squareRoot * squareRoot) % MOD;
  if (n % 2 == 0)
    return squareRoot;
  else
    return (squareRoot * a) % MOD;
}
long long inv(long long a) { return pow(a, MOD - 2); }
int main(void) {
  vector<long long> fact(5001, 1);
  for (int i = 1; i <= 5000; i++) {
    fact[i] = (fact[i - 1] * i) % MOD;
  }
  vector<long long> invFact(5001);
  for (int i = 0; i <= 5000; i++) {
    invFact[i] = inv(fact[i]);
  }
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  vector<vector<long long>> dp(n);
  for (int i = 0; i < n; i++) {
    dp[i] = vector<long long>(i + 3, 0);
  }
  dp[0][0] = 1;
  dp[0][1] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= i + 1; j++) {
      dp[i][j] = dp[i - 1][j];
    }
    dp[i][1]++;
    int l = i - 1;
    while (l >= 0) {
      if (a[l] > a[i] / 2)
        l--;
      else
        break;
    }
    if (l == -1) {
      continue;
    }
    dp[i][1]--;
    long long initSum = 0;
    for (int j = 1; j <= l + 2; j++) {
      initSum = (initSum + dp[l][j - 1] * fact[l - j + 2]) % MOD;
      dp[i][j] = (dp[i][j] + initSum * invFact[l - j + 2]) % MOD;
    }
  }
  cout << dp[n - 1][n] << endl;
}
