B. Similar Strings
time limit per test
3 seconds
memory limit per test
256 megabytes
input
stdin
output
stdout

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.

Input

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

Output the only integer —the number of pairs of similar strings.

Examples
Input
4
abacaba
tetatet
test
bear
Output
1
Input
4
jury
code
will
pass
Output
2
Input
4
your
code
wont
pass
Output
3