#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int a[5005];
int dp[5005][5005 * 2];
int add(int x, int y) { return ((x + y) % mod + mod) % mod; }
int mul(int x, int y) { return (long long)x * y % mod; }
int mypow(int x, int c) {
  int ret = 1;
  while (c > 0) {
    if (c & 1) {
      ret = mul(ret, x);
    }
    c /= 2;
    x = mul(x, x);
  }
  return ret;
}
int dp2[5005];
int g[5005];
void solve() {
  int n;
  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 (2 * a[j] <= a[i]) {
        ++g[i];
      }
    }
  }
  if (a[n - 1] * 2 > a[n]) {
    printf("0\n");
    return;
  }
  dp[0][5005] = 1;
  for (int i = 1; i <= n; ++i) {
    int j;
    for (j = i - 1; j >= 0; --j) {
      if (a[j] * 2 <= a[i]) {
        break;
      }
    }
    for (int k = 0; k <= n; ++k) {
      dp2[k] = 0;
    }
    for (int k = 0; k < 5005 * 2; ++k) {
      int num = k + g[i] - 5005;
      if (num < 0) {
        continue;
      }
      if (num >= i) {
        break;
      }
      dp2[num] = dp[j][k];
    }
    for (int k = i - 1; k >= 0; --k) {
      if (k - 1 >= 0) {
        dp2[k - 1] = add(dp2[k - 1], mul(k, dp2[k]));
      }
      dp[i][k - g[i] + 5005 - 1] = dp2[k];
    }
    if (i == n) {
      printf("%d\n", dp2[0]);
    }
    for (int k = 0; k < 5005 * 2; ++k) {
      dp[i][k] = add(dp[i - 1][k], dp[i][k]);
    }
  }
}
int main() {
  solve();
  return 0;
}
