#include <bits/stdc++.h>
using namespace std;
const int maxn = 5010, mod = 998244353;
int dp[maxn], a[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x = 1, pt = i - 2;
    while (pt >= 0 && 2 * a[pt] > a[i - 1]) {
      x = 1ll * x * (n - pt - 2) % mod;
      pt--;
    }
    dp[i] = (1ll * dp[i - 1] * (n - i) + 1ll * dp[pt + 1] * x) % mod;
  }
  return cout << dp[n] << endl, 0;
}
