#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long mod(long long n) {
  n %= MOD;
  if (n < 0)
    return n + MOD;
  else
    return n;
}
long long fp(long long a, long long p) {
  long long ans = 1, c = a;
  for (long long i = 0; (1ll << i) <= p; ++i) {
    if ((p >> i) & 1) ans = mod(ans * c);
    c = mod(c * c);
  }
  return ans;
}
long long dv(long long a, long long b) { return mod(a * fp(b, MOD - 2)); }
struct M {
  long long x;
  M(long long x_) { x = mod(x_); }
  M() { x = 0; }
  M operator+(M y) {
    long long ans = x + y.x;
    if (ans >= MOD) ans -= MOD;
    return M(ans);
  }
  M operator-(M y) {
    long long ans = x - y.x;
    if (ans < 0) ans += MOD;
    return M(ans);
  }
  M operator*(M y) { return M(x * y.x % MOD); }
  M operator/(M y) { return M(x * fp(y.x, MOD - 2) % MOD); }
  M operator+(long long y) { return (*this) + M(y); }
  M operator-(long long y) { return (*this) - M(y); }
  M operator*(long long y) { return (*this) * M(y); }
  M operator/(long long y) { return (*this) / M(y); }
  M operator^(long long p) { return M(fp(x, p)); }
  void operator+=(M y) { *this = *this + y; }
  void operator-=(M y) { *this = *this - y; }
  void operator*=(M y) { *this = *this * y; }
  void operator/=(M y) { *this = *this / y; }
  void operator+=(long long y) { *this = *this + y; }
  void operator-=(long long y) { *this = *this - y; }
  void operator*=(long long y) { *this = *this * y; }
  void operator/=(long long y) { *this = *this / y; }
  void operator^=(long long p) { *this = *this ^ p; }
};
const long long N = 5007;
M first[N], inv[N];
void prec() {
  first[0] = M(1);
  for (long long i = 1; i < N; ++i) first[i] = first[i - 1] * M(i);
  inv[N - 1] = first[N - 1] ^ (MOD - 2);
  for (long long i = N - 2; i >= 0; --i) inv[i] = inv[i + 1] * M(i + 1);
}
M C(long long n, long long k) {
  if (n < k)
    return M(0);
  else
    return first[n] * inv[k] * inv[n - k];
}
M dp[N][N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  dp[0][0] = M(1);
  for (long long i = 0; i + 1 < n; ++i) {
    for (long long j = 0; j <= i; ++j) {
      if (dp[i][j].x) {
        long long x = a[i + 1];
        long long mx = a[j];
        long long have = i + 1;
        if (x * 2 <= mx) {
          dp[i + 1][j] += dp[i][j] * have;
          dp[i + 1][i + 1] += dp[i][j];
        } else {
          dp[i + 1][j] += dp[i][j] * (have - 1);
        }
      }
    }
  }
  M ans(0);
  for (long long i = 0; i < n; ++i) ans += dp[n - 1][i];
  cout << ans.x << '\n';
}
