404350: GYM101484 K Counting Good Teams

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Counting Good Teamstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

When building teams for programming competitions, it is a good idea to team up people that are good at different topics. For instance, it would be a good idea to team up someone who is good at graph problems and bad at geometry problems with someone who is good at geometry problems but bad at graph problems.

GEMA is a programming competition study group with N members. GEMA coaches are interested in counting the number of different good teams that can be created. A good team is composed of 2 members and each member is good at at least one topic that his teammate isn't good at. Two teams are considered different if at least one member is present in one team but not in the other.

GEMA coaches are only considering the M most important topics, and they know, for each member, which topics they are good at, and which topics they are bad at.

Input

The first line of the input contains two integers N (2 ≤ N ≤ 105) and M (2 ≤ M ≤ 21), indicating respectively the number of members in the study group and the number of topics that are being considered.

The second line contains N integers. The i-th integer corresponds to xi (0 ≤ xi < 2M). The j-th least significant digit of the binary representation of xi is 1 if the i-th member is good at the j-th topic and 0 otherwise. For instance, if M = 5 and the i-th member has xi = 11 = (01011)2, it means that he is good at the first, second and fourth topic and bad at the third and fifth topic.

Output

Output a single integer: the number of different good teams that can be created.

ExamplesInput
2 3
1 4
Output
1
Input
5 4
1 6 13 3 11
Output
6
Input
3 3
1 3 7
Output
0

Source/Category

加入题单

上一题 下一题 算法标签: