#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 998244353;
const int MAXN = 5005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
int a[MAXN], f[MAXN][MAXN], s[MAXN][MAXN], num[MAXN];
int upd(int x, int y) { return x + y >= mods ? x + y - mods : x + y; }
signed main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = 1, l = 0; i <= n; i++) {
    while (a[l + 1] * 2 <= a[i]) l++;
    num[i] = l;
  }
  for (int i = 1; i <= n; i++) {
    f[i][1]++;
    for (int j = 1; j <= num[i] + 1; j++)
      f[i][j] = upd(f[i][j], s[num[i]][j - 1]);
    for (int j = 2; j <= num[i] + 1; j++)
      f[i][j] = upd(f[i][j], 1ll * f[i][j - 1] * (num[i] - j + 2) % mods);
    for (int j = 1; j <= n; j++) s[i][j] = upd(s[i - 1][j], f[i][j]);
  }
  printf("%d", f[n][n]);
  return 0;
}
