#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int a[5005];
int dp[5005][5005], sum[5005][5005];
int pv[5005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n);
  int j = 0;
  for (int i = 1; i <= n; i++) {
    while (a[j + 1] * 2 <= a[i]) j++;
    pv[i] = j;
  }
  for (int i = 1; i <= n; i++) {
    dp[i][0] = (dp[i][0] + 1) % mod;
    for (int j = 1; j <= n; j++) {
      dp[i][j] = (dp[i][j] + sum[pv[i]][j - 1]) % mod;
      if (j <= pv[i])
        dp[i][j] = (dp[i][j] + dp[i][j - 1] * 1ll * (pv[i] - (j - 1))) % mod;
    }
    for (int j = 0; j <= n; j++) {
      sum[i][j] = (sum[i - 1][j] + dp[i][j]) % mod;
    }
  }
  printf("%d\n", dp[n][n - 1]);
}
