#Lutece0584. CBS number

CBS number

Migrated from Lutece 584 CBS number

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

You are given MM numbers. We define XX as CBS number if the binary sequence of XX contains the binary sequence of any other numbers in these MM numbers.

Now can you tell me how many CBS numbers in the range of [l,r][l,r].

Input

The first line contains a single integer TT(T30T\leq 30),the number of test cases.

In each test case, its first line contains a number MM (1M10001\leq M\leq 1000).

In each of next MM lines contains a number xx(1x<2631\leq x<2^{63}).

The last line of each case contains two number l,rl,r(1lr<2631\leq l\leq r<2^{63}).

Output

Please calculate how many CBS numbers in the range of [l,r][l,r].

Samples

1
1
3 
1 100
67

Resources

Sichuan University Programming Contest