#include <bits/stdc++.h>
const int mod = 998244353;
const int maxn = 5051;
int arr[maxn];
int cnt[maxn];
int cnt_pre[maxn];
int dp_ans[maxn];
int dp_new[maxn];
class BinaryTree {
 public:
  int tree[maxn];
  void update(int pos, int val);
  int lowbit(int x) { return x & (-x); }
  int query(int pos);
  void init() { std::memset(tree, 0, sizeof(tree)); }
} bt;
void BinaryTree::update(int pos, int val) {
  for (int i = pos; i < maxn; i += lowbit(i)) tree[i] = (tree[i] + val) % mod;
}
int BinaryTree::query(int pos) {
  int sumv = 0;
  for (int i = pos; i > 0; i -= lowbit(i)) sumv = (sumv + tree[i]) % mod;
  return sumv;
}
void update_ans(int n) {
  for (int i = 1; i <= n; i++) {
    dp_ans[i] = (dp_new[i] + bt.query(i)) % mod;
    dp_new[i] = 0;
  }
  bt.init();
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    dp_ans[i] = 1;
  }
  std::sort(arr + 1, arr + 1 + n);
  if (arr[n] < arr[n - 1] * 2) {
    printf("0");
    return 0;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= n; j++) {
      if (dp_ans[j] == 0) continue;
      int small_value = arr[j] / 2;
      int small_target =
          std::upper_bound(arr + 1, arr + 1 + n, small_value) - arr - 1;
      if (small_target + 1 > i) {
        dp_new[j] = 1ll * dp_ans[j] * (small_target + 1 - i) % mod;
      }
      int big_value = arr[j] * 2;
      int big_target = std::lower_bound(arr + 1, arr + 1 + n, big_value) - arr;
      bt.update(big_target, dp_ans[j]);
    }
    update_ans(n);
  }
  printf("%d\n", dp_ans[n]);
}
