integers, and has a definition of what he calls k-Intersecting Numbers.
hasHe considers a pair of integers "k-Intersecting" if the binary representation of the numbers and differs from each other in exactly bits.
For example, if , the pairs of integers and is k-intersecting because the binary representation and differs exactly in two bits.
Now here's the problem: are in his sequence so that and the pair of integers and is k-intersecting.
wants to know how many pairs of integersCan you help
find the number of pairs that fit in these constraints?Input Specifications
The first line contains two integers and - the number of integers has and the number of bits in which integers in a k-intersecting pair should differ.
The second line contains the sequence , which has.
Output Specifications
Print the number of pairs so that and the pair of integers and is k-intersecting.
Sample Input 1
4 1
0 3 2 1
Sample Output 1
4
Sample Input 2
6 0
200 100 100 100 200 200
Sample Output 2
6
Sample Explanation
In the first sample, there are 4 k-intersecting pairs:
- ,
- ,
- ,
- .
In the second sample where , there are 6 k-intersecting pairs:
- ,
- ,
- ,
- ,
- ,
- .
Comments