## KOMPICI - Kompići

no tags

After successfully solving his math homework from the previous task, Mirko has become bored, so he
has made a list of N large integers. On the list there are some pairs of numbers that he likes, and some
pairs he doesn’t like.
Mirko has named the pairs that he likes pals. Two numbers are pals if they have at least one digit in
common (not necessarily in the same position).
Help Mirko count how many pairs of numbers in his list are pals.
INPUT
The first line of input contains the positive integer N (1 ≤ N ≤ 1 000 000).
Each of the next N lines contains a positive integer from the range [1, 10
18
], a number from Mirko’s
list. No two numbers in the list will be equal.
OUTPUT
The first and only line of output must contain the number of pairs that are pals.

After successfully solving his math homework from the previous task, Mirko has become bored, so he has made a list of N large integers. On the list there are some pairs of numbers that he likes, and some pairs he doesn’t like. Mirko has named the pairs that he likes pals. Two numbers are pals if they have at least one digit in common (not necessarily in the same position).

Help Mirko count how many pairs of numbers in his list are pals

### Input

The first line of input contains the positive integer N (1 ≤ N ≤ 500 000).Each of the next N lines contains a positive integer from the range [1, 10^18], a number from Mirko’s list. No two numbers in the list will be equal.

### Output

The first and only line of output must contain the number of pairs that are pals.

### Example

```Input:
3
4
20
44

Output:
1```