#include <bits/stdc++.h>
using namespace std;
const int N = 5010, M = 5000;
const int mod = 998244353;
int v[N], f[N], lim[N], fac[N], inv[N];
inline int power(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
inline int A(int x, int y) {
  if (x < 0 || y < 0 || x < y) return 0;
  return 1ll * fac[x] * inv[x - y] % mod;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i <= M; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  inv[M] = power(fac[M], mod - 2);
  for (int i = M - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  sort(v + 1, v + n + 1);
  int tail = 0;
  for (int i = 1; i <= n; i++) {
    while (tail < n && 2 * v[tail + 1] <= v[i]) tail++;
    lim[i] = tail;
  }
  f[0] = 1, lim[0] = -1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= lim[i]; j++)
      f[i] =
          (f[i] + 1ll * f[j] * A(n - 2 - lim[j], lim[i] - lim[j] - 1) % mod) %
          mod;
  printf("%d\n", (lim[n] == n - 1) * f[n]);
  return 0;
}
