#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 998244353;
const LL NS = (LL)5004;
LL N;
LL a[NS];
LL dp[NS][NS];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (LL i = 1; i <= N; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + N + 1);
  dp[1][1] = dp[1][0] = 1;
  dp[0][0] = 1;
  for (LL i = 2; i <= N; ++i) {
    dp[i][0] = 1;
    for (LL j = 1; j <= i; ++j) {
      dp[i][j] = dp[i - 1][j];
    }
    int last = 0;
    while (a[last + 1] * 2 <= a[i]) {
      ++last;
    }
    LL sum = 0;
    for (LL j = 1; j <= last + 1; ++j) {
      sum *= last + 1 - j + 1;
      sum %= MOD;
      sum += dp[last][j - 1];
      sum %= MOD;
      dp[i][j] += sum;
      dp[i][j] %= MOD;
    }
  }
  cout << dp[N][N];
  return 0;
}
