#K67302. Count Numbers Consisting Only of 1 and 2

    ID: 32612 Type: Default 1000ms 256MiB

Count Numbers Consisting Only of 1 and 2

Count Numbers Consisting Only of 1 and 2

Given an integer N, count how many numbers in the range from 1 to N (inclusive) consist solely of the digits 1 and 2.

A number is considered valid if every digit in its decimal representation is either a 1 or a 2. For example, for N = 22, the valid numbers are 1, 2, 11, 12, 21, and 22.

You may assume that N is in the range \(0 \leq N \leq 10^6\).

Input Example: When the input is a single integer 10, the valid numbers are 1 and 2, so the output should be 2.

inputFormat

The input consists of a single line containing an integer \(N\) representing the upper bound.

\(0 \leq N \leq 10^6\).

outputFormat

Print a single integer which is the count of numbers between 1 and \(N\) (inclusive) that are composed solely of the digits 1 and 2.

## sample
10
2