#C11424. Anagram Pairs

    ID: 40739 Type: Default 1000ms 256MiB

Anagram Pairs

Anagram Pairs

Given a list of strings, determine the number of pairs of indices \( (i, j) \) (with \( i < j \)) such that the two strings are anagrams of each other. Two strings are anagrams if one can be rearranged to form the other. For example, the strings "listen", "silent", and "enlist" are all anagrams.

Your task is to compute the total number of anagram pairs.

Note: Use the formula \( \frac{c \times (c-1)}{2} \) for each group of \( c \) identical (anagram) entries.

inputFormat

The first line contains a single integer \( n \) indicating the number of strings.

Each of the following \( n \) lines contains a non-empty string consisting of lowercase English letters.

outputFormat

Output a single integer representing the number of anagram pairs.

## sample
5
listen
silent
enlist
google
gooegl
4