#include <bits/stdc++.h>
using namespace std;
long long DIV = 998244353;
long long Hatvany(long long n, long long h) {
  if (h == 0) return 1;
  return (h & 1 ? Hatvany(n * n % DIV, h >> 1) * n
                : Hatvany(n * n % DIV, h >> 1)) %
         DIV;
}
long long table[5000][5000];
long long fakt[5001], fakt2[5001];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  fakt[0] = 1;
  for (int i = 1; i < 5001; i++) fakt[i] = fakt[i - 1] * (long long)i % DIV;
  for (int i = 0; i < 5001; i++) fakt2[i] = Hatvany(fakt[i], DIV - 2);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    int x = i - 1;
    while (x >= 0 && v[x] * 2 > v[i]) x--;
    table[i][0] = 1;
    long long ossz = 0;
    for (int j = 1; j < x + 2; j++) {
      ossz =
          ((long long)ossz * max(1, x - j + 2) % DIV + table[x][j - 1]) % DIV;
      table[i][j] = ossz;
    }
    for (int j = 1; j < x + 2; j++)
      table[i][j] = (table[i][j] + fakt[x + 1] * fakt2[x - j + 1] % DIV) % DIV;
    for (int j = 0; j < n && i > 0; j++)
      table[i][j] = (table[i][j] + table[i - 1][j]) % DIV;
  }
  cout << table[n - 1][n - 1] << "\n";
  return 0;
}
