#arc115a. [arc115_a]Two Choices

[arc115_a]Two Choices

Problem Statement

NN students took a test with MM questions with two choices: 00 and 11. You are given NN strings of length MM each: S1,S2,ldots,SNS_1, S_2, \\ldots, S_N. The kk-th character of SiS_i is 0 or 1, representing the response of the ii-th student to the kk-th question. Although we know the response of each student to each question, we do not yet know the correct answer ― 00 or 11 ― to each problem. Find the number of pairs (i,j)(i, j) satisfying 1leqi<jleqN1 \\leq i < j \\leq N such that it is impossible for Student ii and Student jj to have the same number of correct answers.

Constraints

  • 2leqNleq1052 \\leq N \\leq 10^5
  • 1leqMleq201 \\leq M \\leq 20
  • SiS_i is a string of length MM consisting of 0 and 1.

Input

Input is given from Standard Input in the following format:

NN MM S1S_1 S2S_2 :: SNS_N

Output

Print the answer.


Sample Input 1

3 2
00
01
10

Sample Output 1

2

For example, if the correct answers to the 11-st and 22-nd questions are both 00, Student 22 and Student 33 have the same number of correct answers ― 11. On the other hand, Student 11 and Student 22 never have the same number of correct answers, nor do Student 11 and Student 33.


Sample Input 2

7 5
10101
00001
00110
11110
00100
11111
10000

Sample Output 2

10