#include <bits/stdc++.h>
using namespace std;
const int NMAX = 5000;
const int MOD = 998244353;
int N, w[NMAX + 2], dbl[NMAX + 2], half[NMAX + 2];
int dp[NMAX + 2][NMAX + 2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> w[i];
  }
  sort(w + 1, w + N + 1);
  for (int i = 1; i <= N; i++) {
    int st = i + 1, dr = N, sol = -1;
    while (st <= dr) {
      int mid = (st + dr) >> 1;
      if (w[mid] >= 2 * w[i]) {
        sol = mid;
        dr = mid - 1;
      } else {
        st = mid + 1;
      }
    }
    dbl[i] = sol;
    st = 1, dr = i - 1, sol = -1;
    while (st <= dr) {
      int mid = (st + dr) >> 1;
      if (w[mid] * 2 <= w[i]) {
        sol = mid;
        st = mid + 1;
      } else {
        dr = mid - 1;
      }
    }
    if (sol == -1) {
      half[i] = 0;
    } else {
      half[i] = sol;
    }
  }
  for (int i = 1; i <= N; i++) dp[1][i] = 1;
  for (int i = 1; i < N; i++) {
    for (int j = 1; j <= N; j++)
      if (dbl[j] != -1) {
        dp[i + 1][dbl[j]] = (dp[i + 1][dbl[j]] + dp[i][j]) % MOD;
      }
    for (int j = 1; j <= N; j++) {
      dp[i + 1][j] = (dp[i + 1][j] + dp[i + 1][j - 1]) % MOD;
    }
    for (int j = 1; j <= N; j++) {
      dp[i + 1][j] =
          (dp[i + 1][j] + 1LL * max(0, half[j] - i + 1) * dp[i][j]) % MOD;
    }
  }
  cout << dp[N][N] << '\n';
  return 0;
}
