1672 - And

Time Limit : 10 Second

Memory Limit : 512 MB

Submission: 19

Solved: 14

Description

As the prominent ADAS provider in China, Minieye attracts a lot of attention within the industry and is expected to have great market potential. Now the development of Minieye products is at the crucial stage. Minieye are recruiting talented people to join.Minieye offer competitive salaries, options and bonus, in addition to flexible working hours and regular self-driving travels.


  There are n candidates applying for the jobs in Minieye. The ith candidate has a number , representing which skills the candidate has 0 <= ai < 2^20, . For each number t, 0 <= t < 2^20, the human resource department wants to know how many subsets of candidates, {a_p1,a_p2,a_p3,...a_pk}, 0<p1<p2<p3<...<pk<=n , that a_p1&a_p2&a_p3&...&a_pk = t. In other words, for each t, you need to find out how many subsets that AND result of each numbers in the subsets equals to t. Since the answer may be large, you just need to print out answer % (10^9 + 7).


 

Input

We have multiply cases. For each cases:


The first line contains a single integer n (1≤n≤10^6).


The second line contains n integers a1,a2,...,an (0 <= ai < 2^20).


The third line contains a single integer tn (1≤tn<2^20) representing the number of t


The forth line contains tn integers t1,t2,...,tn (0 <= ai < 2^20).

Output

For each cases, Output tn single integer representing the number of required groups modulo 1000000007 (10^9+7).

sample input
3
1 2 3
4
0 1 2 3
sample output
2 2 2 1
hint
source
sheep.
© 2015 HUST ACMICPC TEAM. All Right Reserved.