#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
const int mod = 998244353;
int n, m, i, j, a[5005], dp[5005][5005], s[5005][5005];
int main() {
  read(n);
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    read(a[i]);
  }
  sort(a + 1, a + n + 1);
  dp[0][0] = s[0][0] = 1;
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    int t = upper_bound(a + 1, a + n + 1, a[i] / 2) - a;
    for (((j)) = (1); ((j)) <= ((i)); ((j))++) {
      dp[i][j] = (dp[i][j] + s[t - 1][j - 1]) % mod;
    }
    for (((j)) = (1); ((j)) <= ((t)); ((j))++) {
      dp[i][j] = (dp[i][j] + 1ll * dp[i][j - 1] * (t - j + 1)) % mod;
    }
    for (((j)) = (0); ((j)) <= (((int)(i + 1)) - 1); ((j))++) {
      s[i][j] = (s[i - 1][j] + dp[i][j]) % mod;
    }
  }
  printf("%d\n", dp[n][n]);
  return 0;
}
