#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 5;
const long long mo = 998244353;
int n, m, k;
int a[maxn], c[maxn];
int ans, tmp, cnt;
int flag;
long long dp[maxn][maxn];
template <typename T>
inline void read(T &X) {
  X = 0;
  int w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  if (w) X = -X;
}
void solve() {
  read(n);
  for (int i = (1); i <= (n); i++) {
    read(a[i]);
  }
  sort(a + 1, a + 1 + n);
  dp[0][0] = 1;
  for (int i = (1); i <= (n); i++) {
    long long sum = dp[i - 1][0];
    int t = 0;
    for (int j = (1); j <= (n); j++) {
      while (t < n && a[t + 1] * 2 <= a[j]) {
        t++;
        sum += dp[i - 1][t];
      }
      dp[i][j] = (dp[i][j] + sum) % mo;
      if (t - i + 2 > 0)
        dp[i][j] = (dp[i][j] + dp[i - 1][j] * (t - i + 2) % mo) % mo;
    }
  }
  printf("%lld\n", dp[n][n]);
}
int main() {
  int T = 1, cas = 1;
  while (T--) {
    solve();
  }
  return 0;
}
