#B3883. Count Palindromic Numbers

    ID: 11540 Type: Default 1000ms 256MiB

Count Palindromic Numbers

Count Palindromic Numbers

A palindrome number is a positive integer which reads the same forward and backward. For example, numbers such as \(22\), \(131\), \(2442\), \(37073\) and \(6\) are palindromes. Note that all one-digit numbers are palindromes.

Given a positive integer \(n\), count the number of palindromic numbers in the range \([1, n]\).

inputFormat

The input contains one positive integer \(n\).

outputFormat

Output a single integer representing the count of palindromic numbers in the range \([1, n]\).

sample

10
9