The greatest company, Pied Piper, is developing encryption systems.
The company has already built decryption systems. Each decryption system consists of an integer key, .
After developing an encryption system, it will encrypt the message “Hello World”. The encrypted message will be an integer, . Then they will check the acceptance of that encryption system.
The decryption system can decrypt the encrypted message, if it holds the following condition:
The acceptance of an encryption system is the number of decryption systems that can decrypt the encrypted form of the message “Hello World” generated by it.
There will be queries. Each of the queries will consist of an encrypted form of the message “Hello World”, generated by encryption system. Determine the acceptance of that encryption system.
The first line contains one integer, the number of decryption systems.
The second line consists of space-separated integers, , the key for each decryption system .
The third line contains an integer, , the number of queries.
Each of the next lines contains , the encrypted message generated by the encryption system.
For each query, output the acceptance of the corresponding encryption system.
2 2 5 3 7 8 10
2 1 0