A billing system stores n non-negative invoice amounts. Two invoices belong to the same "digit-sum bracket" if the sum of the decimal digits of their amounts is identical (for example, 12 and 111 both have digit sum 3, since 1+2=3 and 1+1+1=3).
Count the number of unordered pairs of invoices (i, j) with i < j whose digit sums are equal.
Input format
Line 1: an integer n.
Line 2: n space-separated non-negative integers (the invoice amounts).
Output format
A single integer: the number of pairs (i, j), i < j, whose digit sums match.
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ each amount ≤ 1000000000