After successfully solving his math homework from the previous task, Mirko has become bored, so he has made a list of 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 Specification
The first line of input contains the positive integer .
Each of the next lines contains a positive integer from the range , a number from Mirko's list. No two numbers in the list will be equal.
Output Specification
The first and only line of output must contain the number of pairs that are pals.
Sample Input 1
3
4
20
44
Sample Output 1
1
Sample Input 2
4
32
51
123
282
Sample Output 2
4
Comments