#P8752. Special Year Counting

    ID: 21916 Type: Default 1000ms 256MiB

Special Year Counting

Special Year Counting

A year is considered special if it satisfies the following conditions when written as a 4-digit number:

  • The thousands digit is equal to the tens digit.
  • The ones digit is equal to the hundreds digit plus 1.

For example, the year \(2021\) is special because its digits are \(2,0,2,1\): the thousands digit (2) is equal to the tens digit (2), and the ones digit (1) equals the hundreds digit (0) plus 1.

You are given 5 years as input. Your task is to count how many of those years are special years.

inputFormat

The input consists of a single line containing 5 space-separated integers, each representing a year.

outputFormat

Output a single integer indicating the number of special years among the given 5 years.

sample

2021 2222 2011 1223 1334
1