#include <bits/stdc++.h>
using namespace std;
const int M = 998244353;
int power(int a, int p) {
  if (p == 0) return 1;
  int ans = power(a, p / 2);
  ans = (1LL * ans * ans) % M;
  if (p % 2) ans = (1LL * ans * a) % M;
  return ans;
}
const int N = 5005;
long long fac[N], invfac[N];
void pre() {
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = (1LL * i * fac[i - 1]) % M;
  invfac[N - 1] = power(fac[N - 1], M - 2);
  for (int i = N - 2; i >= 0; i--)
    invfac[i] = (1LL * invfac[i + 1] * (i + 1)) % M;
}
int dp[N][N];
int ss[N][N];
int a[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  pre();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  dp[0][0] = 1;
  ss[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int x = 0;
    while (a[x + 1] * 2 <= a[i]) x++;
    dp[i][0] = dp[i - 1][0];
    ss[i][0] = (dp[i][0] * fac[i]) % M;
    for (int k = 1; k <= x + 1; k++)
      dp[i][k] = (dp[i - 1][k] + ss[x][k - 1] * invfac[x - k + 1]) % M;
    ss[i][0] = (dp[i][0] * fac[i]) % M;
    for (int k = 1; k <= i; k++)
      ss[i][k] = (ss[i][k - 1] + dp[i][k] * fac[i - k]) % M;
  }
  cout << dp[n][n] << endl;
}
