#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
const int MAXN = 5001;
vector<vector<long long int>> dp(MAXN, vector<long long int>(MAXN, 0));
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<long long int> cnt(n + 1, 0);
  sort(a.begin(), a.end());
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      if (2 * a[j] <= a[i]) cnt[i]++;
    }
  }
  vector<vector<long long int>> pdp(n + 1, vector<long long int>(n + 1, 0));
  for (int i = 1; i <= n; i++) {
    dp[1][i] = 1;
    pdp[1][i] = i;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (cnt[j] >= i - 1)
        dp[i][j] =
            (dp[i - 1][j] * (cnt[j] - i + 2)) % (long long int)(998244353);
      int l = 1, r = n;
      while (r >= l) {
        int mid = (l + r) / 2;
        if (2 * a[mid] > a[j])
          r = mid - 1;
        else
          l = mid + 1;
      }
      dp[i][j] = (dp[i][j] + pdp[i - 1][r]) % (long long int)(998244353);
      pdp[i][j] = (pdp[i][j - 1] + dp[i][j]) % (long long int)(998244353);
    }
  }
  long long int ans = pdp[n][n];
  cout << ans;
}
