You are given an array a of size n having distinct prime integers.
You will be given q queries. In each query, you will be given an integer k and you have to count the sum of Perfect Factors of the factors of this number.
Perfect Factors: Let's suppose an integer k. Suppose z1,z2,...,zt (t = number of factors) are the factors of integer k. Let's consider one of the factor, say zi. We now calculate how many elements in the provided array (a) perfectly divide this number. Suppose ci is the number of elements in the array that are perfectly dividing the factor zi. Therefore, number of perfect factors for factor zi = ci. So sum of perfect factors of all the factors of number k is c1+c2+...+ct.
Input Format:
Output Format:
For each query, output in a separate line:
The sum of Perfect Factors of the factors of the number.
Constraints:
1≤n≤105
2≤ai≤9999889
1≤q≤106
1≤k≤107
It is guaranteed that all elements of a are distinct and are prime numbers.
For the sixth query, k= 6. Factors of 6 are: 1,2,3,6. Number of elements of array a that perfectly divides 1 are 0. Similarly for 2,3,6 it is 1,1,2 respectively. Therefore, the answer for this query is 0+1+1+2=4.