#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5005;
const long long mod = 998244353;
long long n, a[maxn], c[maxn];
long long sum[maxn], dp[maxn][maxn];
long long find(long long x) {
  long long l = 1, r = x, res = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (2 * a[mid] <= a[x]) {
      res = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return res;
}
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  sort(a + 1, a + n + 1);
  c[1] = 0;
  for (long long l = 0, r = 2; r <= n;) {
    while (2 * a[l + 1] <= a[r]) ++l;
    c[r] = l;
    ++r;
  }
  for (long long i = 1; i <= n; ++i) {
    dp[1][i] = 1;
    (sum[i] = sum[i - 1] + dp[1][i]) %= mod;
  }
  for (long long i = 2; i <= n; ++i) {
    for (long long j = 1; j <= n; ++j) {
      long long tmp = 0;
      (tmp += sum[c[j]]) %= mod;
      (tmp += dp[i - 1][j] * (c[j] - i + 2)) %= mod;
      (dp[i][j] += tmp) %= mod;
    }
    for (long long j = 1; j <= n; ++j) {
      (sum[j] = sum[j - 1] + dp[i][j]) %= mod;
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    (ans += dp[n][i]) %= mod;
  }
  cout << ans;
  return 0;
}
