We call a pair of non-negative integers suitable if there is at least one common digit in their decimal notation (not necessarily in the same digit). Let there be given n non-negative numbers
an. Consider all possible pairs (
aj) (1 ≤ i < j ≤ n).
Write a program that will determine the number of all suitable pairs.
The first line contains positive integer n, not greater than
106. Second line contains n nonnegative integers, not greater 999.
Print the number of suitable pairs.
4 1 2 12 21
4 0 10 22 22