#C1565. Counting Palindromic Numbers

    ID: 44784 Type: Default 1000ms 256MiB

Counting Palindromic Numbers

Counting Palindromic Numbers

Given a positive integer \(n\), count how many positive integers from 1 to \(n\) are palindromic. A number is considered palindromic if it reads the same forwards and backwards. For example, \(121\) and \(1331\) are palindromic, while \(10\) is not.

Your task is to implement an algorithm that computes the number of palindromic numbers \(P(n)\) where:

\[ P(n) = |\{i \in \mathbb{Z}^+ : 1 \le i \le n \text{ and } i \text{ is palindromic}\}| \]

Input will be provided via standard input (stdin) and the output should be written to standard output (stdout).

inputFormat

The input consists of a single integer \(n\) (with \(1 \le n \le 10^5\) for instance) provided on one line via standard input.

outputFormat

Output a single integer which is the number of palindromic numbers from 1 to \(n\). The answer should be printed to standard output.

## sample
10
9