#abc137c. [abc137_c]Green Bin

[abc137_c]Green Bin

Problem Statement

We will call a string obtained by arranging the characters contained in a string aa in some order, an anagram of aa.

For example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.

Given are NN strings s1,s2,ldots,sNs_1, s_2, \\ldots, s_N. Each of these strings has a length of 1010 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i,ji, j (1leqi<jleqN)(1 \\leq i < j \\leq N) such that sis_i is an anagram of sjs_j.

Constraints

  • 2leqNleq1052 \\leq N \\leq 10^5
  • sis_i is a string of length 1010.
  • Each character in sis_i is a lowercase English letter.
  • s1,s2,ldots,sNs_1, s_2, \\ldots, s_N are all distinct.

Input

Input is given from Standard Input in the following format:

NN s1s_1 s2s_2 :: sNs_N

Output

Print the number of pairs of integers i,ji, j (1leqi<jleqN)(1 \\leq i < j \\leq N) such that sis_i is an anagram of sjs_j.


Sample Input 1

3
acornistnt
peanutbomb
constraint

Sample Output 1

1

s1=s_1 = acornistnt is an anagram of s3=s_3 = constraint. There are no other pairs i,ji, j such that sis_i is an anagram of sjs_j, so the answer is 11.


Sample Input 2

2
oneplustwo
ninemodsix

Sample Output 2

0

If there is no pair i,ji, j such that sis_i is an anagram of sjs_j, print 00.


Sample Input 3

5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa

Sample Output 3

4

Note that the answer may not fit into a 3232-bit integer type, though we cannot put such a case here.