#include <bits/stdc++.h>
using namespace std;
const int N = 5050;
const int p = 998244353;
int n;
int a[N], b[N];
int dp[N][N], sum[N][N];
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++)
    b[i] = upper_bound(a + 1, a + n + 1, a[i] / 2) - a - 1;
  dp[0][0] = sum[0][0] = 1;
  for (int j = 1; j <= n; j++) sum[0][j] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (b[j] >= i - 1)
        dp[i][j] = (sum[i - 1][b[j]] + 1ll * dp[i - 1][j] * (b[j] - i + 2)) % p;
    }
    for (int j = 1; j <= n; j++) sum[i][j] = (dp[i][j] + sum[i][j - 1]) % p;
  }
  if (0)
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        cout << dp[i][j] << " ";
      }
      cout << endl;
    }
  printf("%d\n", dp[n][n]);
  return 0;
}
