#B2068. Count Four-Digit Numbers with Positive Digit Difference

    ID: 11150 Type: Default 1000ms 256MiB

Count Four-Digit Numbers with Positive Digit Difference

Count Four-Digit Numbers with Positive Digit Difference

You are given several four-digit numbers. For each number, let the digits be denoted as follows:

  • a: Thousands digit
  • b: Hundreds digit
  • c: Tens digit
  • d: Units digit

The task is to count how many numbers satisfy the condition:

$$d - a - b - c > 0$$

Note: Ensure that you use LaTeX formatting for any formulas in your solution description.

inputFormat

The first line of input contains an integer n representing the number of four-digit numbers. The following line (or lines) contains n four-digit numbers separated by spaces or newlines.

outputFormat

Output a single integer—the count of numbers that satisfy the condition $$d - a - b - c > 0$$.

sample

3
1234 1111 1008
1