#include <bits/stdc++.h>
const int mu = 998244353, N = 5005;
int a[N], n, b[N], inv[N], p[N], dp[N], pre[N];
void reduce(int &x) { x += x >> 31 & mu; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  std::sort(a + 1, a + n + 1);
  int pt = 0;
  for (int i = 1; i <= n; i++) {
    while (pt < n && a[pt + 1] * 2 <= a[i]) pt++;
    b[i] = pt;
  }
  if (b[n] < n - 1) return puts("0"), 0;
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= n; i++)
    inv[i] = (long long)inv[mu % i] * (mu - mu / i) % mu;
  dp[0] = 1;
  pre[0] = inv[n];
  for (int i = 1; i <= n; i++) {
    dp[i] = pre[b[i]];
    pre[i] = (pre[i - 1] + (long long)dp[i] * inv[n - b[i] - 1]) % mu;
  }
  int ans = dp[n];
  for (int i = 1; i <= n; i++) ans = (long long)ans * i % mu;
  printf("%d\n", ans);
}
