Let's call two strings similar if there exists a bijective mapping over characters, which, when applied to the characters of the first string, makes it equal to the second string. For example, «abacaba» and «tetatet» are similar strings, but «test» and «bear» — are not. Given the set of strings, find the number of pairs of similar strings.
The first line contains one integer n — the number of strings.
Next n lines contain non-empty strings of lowercase Latin letters. The sum of lengths of these strings does not exceed 106.
Output the only integer —the number of pairs of similar strings.
4
abacaba
tetatet
test
bear
1
4
jury
code
will
pass
2
4
your
code
wont
pass
3