#include <bits/stdc++.h>
const int maxn = 5003;
const int ha = 998244353;
int add_mod(int x, int y) {
  int ans = x + y;
  if (ans >= ha) ans -= ha;
  return ans;
}
int mul_mod(int x, int y) {
  return (long long)x * (long long)y % (long long)ha;
}
int half_p[maxn], A[maxn], n;
int d[maxn][maxn], sum[maxn][maxn];
void dp() {
  d[0][0] = 1;
  sum[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    const int p = half_p[i];
    d[i][0] = 0;
    sum[i][0] = 1;
    for (int j = 1; j <= n; j++) {
      if (p + 2 >= j) d[i][j] = mul_mod(d[i][j - 1], p - j + 2);
      d[i][j] = add_mod(d[i][j], sum[p][j - 1]);
      sum[i][j] = add_mod(sum[i - 1][j], d[i][j]);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
  std::sort(A + 1, A + 1 + n);
  int p = 0;
  for (int i = 1; i <= n; i++) {
    while ((A[p + 1] << 1) <= A[i]) p++;
    half_p[i] = p;
  }
  dp();
  printf("%d\n", sum[n][n]);
  return 0;
}
