#Lutece3349. Simple Counting

Simple Counting

Description

Given an array aa whose length is nn and two integers k1k_1 and k2k_2. In one operation, you can choose an index ii (1in1\le i\le n) and add either k1k_1 or k2k_2 to aia_i.

For an unordered integer pair (i,j)(i,j) (1i,jn,ij1\le i,j\le n, i\neq j), if you can perform a finite number of times (which can be zero) of the operation, resulting in ai=aja_i=a_j, then the pair (i,j)(i,j) is good.

Count the number of good unordered pairs in the array.

Input

The first line contains three integers n,k1,k2n,k_1,k_2 (2n105,1k1,k21062\le n\le 10^5,1\le k_1,k_2\le 10^6).

The second line contains nn integers a1,a2,,ana_1,a_2,\ldots,a_n (1ai1061\le a_i\le 10^6), indicating the array.

Output

Output an integer indicating the answer.

Samples

6 56482 114514
6 6 6 6 6 6
15
3 7 2
11 21 7
3
6 1 1
58 45 15 25 26 9
15

Note

For the second example, all pairs meet the requirements. For example, with the pair (1,2)(1, 2), choosing ii as 1 and adding k2k_2, after performing this operation five times, we have a1=21a_1 = 21 and a2=21a_2 = 21; thus, the pair (1,2)(1, 2) satisfies the requirement. Please note that (1,2)(1, 2) and (2,1)(2, 1) are considered the same pair.

Resources

电子科技大学第十五届 ACM 趣味程序设计竞赛