#B3882. Counting Palindromic Numbers

    ID: 11539 Type: Default 1000ms 256MiB

Counting Palindromic Numbers

Counting Palindromic Numbers

A palindromic number is a number that remains the same when its digits are reversed.

For example, numbers like $$22$$, $$131$$, $$2442$$, $$37073$$, $$6$$, etc. are palindromic numbers. Note that all one-digit numbers are palindromic.

Given a positive integer $$n$$, count how many palindromic numbers are there in the interval $$[1, n]$$.

inputFormat

The input consists of a single positive integer $$n$$ (for example, (1 \le n \le 10^9)).

outputFormat

Output a single integer representing the number of palindromic numbers in the interval $$[1, n]$$.

sample

9
9