#arc136d. [arc136_d]Without Carry
[arc136_d]Without Carry
Problem Statement
You are given an integer sequence of length : .
Find the number of pairs of integers () such that calculation of by column addition does not involve carrying.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
4 8 12 90
Sample Output 1
3
The pairs that count are .
For example, calculation of does not involve carrying, so counts. On the other hand, calculation of involves carrying, so does not count.
Sample Input 2
20
313923 246114 271842 371982 284858 10674 532090 593483 185123 364245 665161 241644 604914 645577 410849 387586 732231 952593 249651 36908
Sample Output 2
6
Sample Input 3
5
1 1 1 1 1
Sample Output 3
10