We call a pair of non-negative integers suitable if their decimal representations have at least one common digit (the digit does not need to be in the same position). Let non-negative integers a_1, a_2, , a_n be given. Consider all possible pairs (a_i, a_j) where 1 \leq i < j \leq n.
Write a program to determine the number of suitable pairs among them.
The first line contains a positive integer (1 \leq n \leq 10^6). The second line contains non-negative integers, each not exceeding .
Print the number of suitable pairs.
Example 1
Example 2