#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## 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 *i*th 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

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 17 | 20 | 1s | 256MB | Minimum |

2 | 20 | 20 | 1s | 256MB | Minimum |

3 | 21 | 20 | 1s | 256MB | Minimum |

4 | 42 | 80 | 1s | 256MB | Minimum |

5 | 0 | 2 | 1s | 256MB | Minimum |

### Judge Compile Command

g++ ans.cpp -o cousins -Wall -static -O2 -lm -m64 -s -w -std=gnu++14 -fmax-errors=512