#include <bits/stdc++.h>
using namespace std;
const int maxN = 5005;
const int INF = (int)2e9;
const int mod = 998244353;
int N, A[maxN], prv[maxN], nxt[maxN];
long long dp[2][maxN];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  sort(A + 1, A + N + 1);
  for (int i = 1; i <= N; ++i) {
    prv[i] = prv[i - 1];
    while (2 * A[prv[i] + 1] <= A[i]) ++prv[i];
  }
  nxt[N + 1] = N + 1;
  A[N + 1] = INF;
  for (int i = N; i > 0; --i) {
    nxt[i] = nxt[i + 1];
    while (2 * A[i] <= A[nxt[i] - 1]) --nxt[i];
  }
  dp[0][1] = 1;
  int c = 0;
  for (int n = 1; n < N; ++n, c ^= 1) {
    for (int i = 0; i <= N + 1; ++i) dp[c ^ 1][i] = 0;
    for (int i = 1; i <= N; ++i) {
      dp[c][i] = (dp[c][i] + dp[c][i - 1]) % mod;
      if (prv[i] - n + 1 > 0) {
        long long v = prv[i] - n + 1;
        v = (v * dp[c][i]) % mod;
        dp[c ^ 1][i] = (dp[c ^ 1][i] + v) % mod;
        dp[c ^ 1][i + 1] = (dp[c ^ 1][i + 1] + ((mod - v) % mod)) % mod;
      }
      dp[c ^ 1][nxt[i]] = (dp[c ^ 1][nxt[i]] + dp[c][i]) % mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= N; ++i) {
    dp[c][i] = (dp[c][i] + dp[c][i - 1]) % mod;
    ans = (ans + dp[c][i]) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
