cswork / OA打开练习工作台

IBMOA #16

Count Similar Pairs

估计中等可在线判题

考点(AI 标注)哈希计数位运算

Two strings are similar if they contain the same set of letters; how many times each letter occurs does not matter. Identical strings at different indices can still form a pair, and (i,j) and (j,i) are counted only once.

输入格式

The first line contains n, followed by n lines of lowercase strings. 1≤n≤100000, total length ≤10^6. The original text does not exclude empty strings; this site's protocol supports an empty line representing an empty string.

输出格式

Output one integer, the answer.

样例 1

输入:

3
xyz
foo
of

输出:

1

样例 2

输入:

2


输出:

1

样例 3

输入:

4
ab
aab
b
ba

输出:

3

样例说明

The examples give 1, 1 and 3 respectively.