#include <bits/stdc++.h>
using namespace std;
long long n, m, a[5005], cnt[5005], da[5005], dp[5005][5005];
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) {
    cnt[i] = upper_bound(a + 1, a + n + 1, a[i] / 2) - a - 1;
    da[i] = lower_bound(a + 1, a + n + 1, 2 * a[i]) - a;
  }
  for (long long j = 1; j <= n; j++) dp[1][j] = 1;
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (cnt[j] - i + 1 > 0) {
        (dp[i + 1][j] += dp[i][j] * (cnt[j] - i + 1)) %= 998244353;
        (dp[i + 1][j + 1] -= dp[i][j] * (cnt[j] - i + 1)) %= 998244353;
      }
      (dp[i + 1][da[j]] += dp[i][j]) %= 998244353;
    }
    for (long long j = 2; j <= n; j++)
      dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i + 1][j]) % 998244353;
  }
  cout << dp[n][n] << endl;
}
