#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 998244353;
const int dx[] = {0, 0, -1, 1, 1, -1, 1, -1};
const int dy[] = {-1, 1, 0, 0, 1, -1, -1, 1};
const int MAXN = 5010;
int C[MAXN][MAXN];
inline int modSum(int a, int b) { return (a + b) % MOD; }
inline int modMul(int a, int b) { return (a * (ll)b) % MOD; }
int first[MAXN][MAXN];
void computeF(int maxN) {
  first[0][0] = 1;
  for (int i = 1; i <= maxN; i++) {
    first[i][0] = 1;
    for (int k = 1; k <= i; k++) {
      first[i][k] = modMul(i, first[i - 1][k - 1]);
    }
  }
}
int v[MAXN], dp[MAXN];
int n;
int solve(int i, int cnt) {
  if (i == n - 1) {
    assert(cnt == n);
    return 1;
  }
  if (dp[i] != -1) return dp[i];
  int ans = 0;
  int b = i;
  for (int j = i + 1; j <= n - 1; j++) {
    if (v[j] < 2 * v[i]) continue;
    while (2 * v[b] <= v[j]) b++;
    ans = modSum(ans, modMul(solve(j, b + 1), first[n - cnt - 1][b - cnt]));
  }
  return dp[i] = ans;
}
int main() {
  memset(dp, -1, sizeof(dp));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v, v + n);
  computeF(n);
  if (v[n - 1] >= 2 * v[n - 2]) {
    int ans = 0;
    int i = 0;
    for (int j = 0; j < n; j++) {
      while (2 * v[i] <= v[j]) i++;
      ans = modSum(ans, modMul(solve(j, i + 1), first[n - 1][i]));
    }
    cout << ans << '\n';
  } else {
    cout << 0 << '\n';
  }
  return 0;
}
