#include <bits/stdc++.h>
using namespace std;
long long n, a[5005], f[5005][5005], c[5005], sum[5005], ans, pos;
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    f[1][i] = 1;
    sum[i] = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      if (a[j] * 2 <= a[i]) c[i]++;
    }
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] = (((f[i - 1][j] * (c[j] - i + 2)) % 998244353) + sum[c[j]]) %
                998244353;
    }
    for (int j = 1; j <= n; j++) sum[j] = (sum[j - 1] + f[i][j]) % 998244353;
  }
  for (int i = 1; i <= n; i++) {
    ans = (ans + f[n][i]) % 998244353;
  }
  cout << ans;
  return 0;
}
