#P1437F. Emotional Fishermen

    ID: 2818 Type: RemoteJudge 4000ms 1024MiB Tried: 0 Accepted: 0 Difficulty: 10 Uploaded By: Tags>combinatoricsdpmathtwo pointers*2600

Emotional Fishermen

Description

nn fishermen have just returned from a fishing vacation. The ii-th fisherman has caught a fish of weight aia_i.

Fishermen are going to show off the fish they caught to each other. To do so, they firstly choose an order in which they show their fish (each fisherman shows his fish exactly once, so, formally, the order of showing fish is a permutation of integers from 11 to nn). Then they show the fish they caught according to the chosen order. When a fisherman shows his fish, he might either become happy, become sad, or stay content.

Suppose a fisherman shows a fish of weight xx, and the maximum weight of a previously shown fish is yy (y=0y = 0 if that fisherman is the first to show his fish). Then:

  • if x2yx \ge 2y, the fisherman becomes happy;
  • if 2xy2x \le y, the fisherman becomes sad;
  • if none of these two conditions is met, the fisherman stays content.

Let's call an order in which the fishermen show their fish emotional if, after all fishermen show their fish according to this order, each fisherman becomes either happy or sad. Calculate the number of emotional orders modulo 998244353998244353.

The first line contains one integer nn (2n50002 \le n \le 5000).

The second line contains nn integers a1a_1, a2a_2, ..., ana_n (1ai1091 \le a_i \le 10^9).

Print one integer — the number of emotional orders, taken modulo 998244353998244353.

Input

The first line contains one integer nn (2n50002 \le n \le 5000).

The second line contains nn integers a1a_1, a2a_2, ..., ana_n (1ai1091 \le a_i \le 10^9).

Output

Print one integer — the number of emotional orders, taken modulo 998244353998244353.

Sample Input 1

4
1 1 4 9

Sample Output 1

20

Sample Input 2

4
4 3 2 1

Sample Output 2

0

Sample Input 3

3
4 2 1

Sample Output 3

6

Sample Input 4

8
42 1337 13 37 420 666 616 97

Sample Output 4

19200