#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long INF = (long long)5e18;
const int MOD = 998244353;
int add(int x, int y) {
  x += y;
  return x >= MOD ? x - MOD : x;
}
int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + MOD : x;
}
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)(ret) * (x) % MOD;
    x = (long long)(x) * (x) % MOD;
    y >>= 1;
  }
  return ret;
}
void checkmin(int &x, int y) {
  if (x > y) x = y;
}
void checkmax(int &x, int y) {
  if (x < y) x = y;
}
void checkmin(long long &x, long long y) {
  if (x > y) x = y;
}
void checkmax(long long &x, long long y) {
  if (x < y) x = y;
}
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
const int N = 5005;
int n, a[N], dp[N];
int fac[N], ifac[N], lim[N];
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (long long)(fac[i - 1]) * (i) % MOD;
  ifac[n] = qpow(fac[n], MOD - 2);
  for (int i = n - 1; i >= 0; i--)
    ifac[i] = (long long)(ifac[i + 1]) * (i + 1) % MOD;
  for (int i = 1; i <= n; i++) {
    for (int j = i - 1; j >= 1; j--) {
      if (a[j] * 2 <= a[i]) {
        lim[i] = j;
        break;
      }
    }
  }
}
void solve() {
  dp[0] = 1;
  if (a[n] < a[n - 1] * 2) {
    puts("0");
    return;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = lim[i]; j >= 0; j--) {
      int delta = lim[i] - lim[j] - 1, rest = n - lim[j] - 2;
      if (j == 0) delta++, rest++;
      dp[i] =
          add(dp[i], (long long)(dp[j]) *
                         ((long long)(fac[rest]) * (ifac[rest - delta]) % MOD) %
                         MOD);
    }
  }
  cout << dp[n] << endl;
}
int main() {
  init();
  solve();
  return 0;
}
