#include <bits/stdc++.h>
using namespace std;
const int Mod = 998244353;
const int N = 5e3 + 10;
int n, m;
int a[N];
long long dp[N][N];
long long sum[N];
long long c[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  a[n + 1] = 2e9;
  int now = 1;
  for (int i = 1; i <= n; i++) {
    while (a[now] * 2 <= a[i]) now++;
    c[i] = now - 1;
  }
  for (int i = 1; i <= n; i++) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) sum[j] = (sum[j - 1] + dp[i - 1][j]) % Mod;
    for (int j = 1; j <= n; j++) {
      dp[i][j] = dp[i - 1][j] * (c[j] - i + 2) % Mod;
      dp[i][j] = (dp[i][j] + sum[c[j]]) % Mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + dp[n][i]) % Mod;
  }
  cout << ans << '\n';
  return 0;
}
