P19574 [HackerEarth] You are given an array A = \{ a_0, a_1...a_{N-1} \} and an integer D. Find the total number of un-ordered pairs (i, j) where i \ne j such that a_i * a_j \equiv 0 \pmod D.
普及-
题目描述

You are given an array A = { a_0, a_1...a_{N-1} } and an integer D. Find the total number of un-ordered pairs (i, j) where $i \ne j$ such that $a_i * a_j \equiv 0 \pmod D$.

INPUT

The first line of each test file contains two space separated integers N and D, where N denotes the size of array A and D is as described above. Next line contains $N space separated integers a_0 \dotso a_{N-1} denoting array A$ .

OUTPUT

Output a single line containing the number of pairs as described in problem statement.

CONSTRAINTS
1 ≤ N ≤ 10^6
1 ≤ D ≤ 10^6
1 ≤ a_i ≤ 10^9

SAMPLE INPUT
7 7
2 2 2 7 2 2 1

SAMPLE OUTPUT
6

Explanation

You can take number at index 4 (1 based indexing) with any of other 6 numbers. Their product will be divisible by D i.e. 7. No other pair will give product divisible by D.

输入格式

见题面

输出格式

见题面

样例输入
297 82 4722 6097 8497 5057 3937 7122 626 626 2002 3282 3122 7937 6962 8097 5217 1 817 8882 6017 626 1 5522 5682 5842 7122 6337 626 1 2242 6577 1 8897 3137 3442 1217 4257 2737 7777 1777 6017 1 6497 337 3057 8577 9842 4497 6242 882 6482 1 6242 5057 162 9137 3922 2322 7122 2017 6402 7057 7537 4817 9457 1 5777 962 3202 9762 6322 9937 626 977 8577 897 8257 3777 1297 8402 8002 626 9442 2097 4482 1522 1922 5122 8962 6017 162 3217 17 1777 2257 257 1 3537 802 4482 626 2177 8977 7217 337 7697 8562 177 4017 9522 3377 9522 1122 6417 7217 2802 3282 8657 1 1377 1922 8657 626 626 4322 1 6002 6897 1 9922 4002 1457 3617 2162 626 7137 1922 4962 8642 4417 9937 5457 1 6562 626 242 2002 962 2097 6977 5762 82 1 6897 1682 1377 6417 4817 4082 2577 1 6097 5442 1042 3922 626 626 4657 5522 2417 2017 6642 2977 7777 1 962 3297 2322 8097 177 1 7202 626 4097 8497 5057 17 6242 3042 6322 3537 7762 7202 1 626 1537 1 3137 626 5777 2242 9937 9937 7377 1 1 1 6977 4562 6082 7442 3777 626 642 9537 402 6162 8097 9842 626 5617 402 9442 626 1 802 577 626 4722 3377 626 1 3682 177 626 626 8337 5282 6177 2657 9922 1 8162 9682 6657 626 8897 1 1297 626 1 8497 7057 5057 2402 1537 626 5937 626 1 8002 1297 562 82 626 1682 626 17 5042 8882 2897 4002 1297 3937 1682 626 8162 5442 8657 8802 1377 7697 1042 9057 3217 7122 3697 6097 4177 5937 1 5362 7042 626 3442 626 626 1442
样例输出
351