Problem Description
Peanut has been visiting his relatives during Chinese New Year, but due to the lack of internet access, he got very bored. As such, he recorded down the names of his N cousins, which all happen to be lowercase strings of at most 10 characters.
He wonders to himself, how many distinct pairs of cousins have names which are anagrams of one another. An anagram is defined as two strings X and Y such that the letters in X can be rearranged to form Y.
Input
The first line of input will contain one integer, N.
The next N lines of input will contain one string each, representing the name of Peanut's ith cousin.
Output
The output should contain one line with one integer, the number of distinct pairs of cousins who have names that are anagrams of one another.
Limits
Subtask 1 (17%): 1 ≤ N ≤ 2000.
Subtask 2 (20%): 1 ≤ N ≤ 300000, the names will only consist of the letter 'a'.
Subtask 3 (21%): 1 ≤ N ≤ 300000, the names will only consist of the letters 'a' and 'b'.
Subtask 4 (42%): 1 ≤ N ≤ 300000.
Subtask 5 (0%): Sample Testcases
Sample Testcase 1
Input
6
a
aaa
aaa
a
aaa
aaaaa
Output
4
Sample Testcase 2
Input
4
anna
bradley
nana
dryable
Output
2