#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long dp[5010][5010];
int n, a[5010], cntless[5010], sum[5010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++)
      if ((a[j] << 1) <= a[i])
        cntless[i]++;
      else
        break;
  for (int i = 1; i <= n; i++) dp[i][1] = 1;
  int now = 1;
  for (int i = 2; i <= n; i++) {
    while ((a[now] << 1) <= a[i]) {
      for (int j = 0; j <= now; j++)
        sum[j] = (sum[j] + dp[now][j] >= mod) ? sum[j] + dp[now][j] - mod
                                              : sum[j] + dp[now][j];
      now++;
    }
    for (int j = 2; j <= cntless[i] + 1; j++) {
      dp[i][j] = sum[j - 1];
      dp[i][j] = (dp[i][j] + dp[i][j - 1] * (cntless[i] - (j - 2)) % mod) % mod;
    }
  }
  printf("%lld\n", dp[n][n]);
  return 0;
}
