An inventory lists n labels, each made of lowercase English letters. Count the number of unordered pairs of positions (i, j) with i < j such that the two labels are anagrams of each other (one can be rearranged into the other).
Input format
Line 1: an integer n, the number of labels.
Line 2: n space-separated labels, each 1 to 20 lowercase English letters.
Output format
A single integer: the number of anagram pairs.
Constraints
- 1 <= n <= 40
- Each label is 1 to 20 lowercase English letters.