#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 10;
const int Mod = 998244353;
int n;
int a[N], dp[N];
template <class fil>
inline void read(fil &ret) {
  ret = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    ret = (ret << 1) + (ret << 3) + (ch ^ 48);
    ch = getchar();
  }
  return;
}
template <class fil>
inline void write(fil Num) {
  if (Num > 9) write(Num / 10);
  putchar(Num % 10 ^ 48);
  return;
}
signed main() {
  read(n);
  for (register int i = 1; i <= n; ++i) read(a[i]);
  sort(a, a + 1 + n);
  long long tmp = 1;
  for (register int i = n - 1; i >= 0; --i) {
    if (a[n] < (a[i] << 1)) break;
    dp[i] = tmp;
    tmp = tmp * (n - i) % Mod;
  }
  for (register int i = n - 1; i >= 1; --i) {
    long long now = dp[i];
    if (!now) continue;
    long long temp = 1;
    for (register int j = i - 1; j >= 0; --j) {
      if ((a[j] << 1) > a[i])
        temp = temp * (n - j - 1) % Mod;
      else {
        dp[j] = (dp[j] + now * temp) % Mod;
        temp = temp * (n - j) % Mod;
      }
    }
  }
  write(dp[0]);
  return 0;
}
