测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A7789. Hexadecimal's Numbers

编程题 普及/提高-

题目描述

One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of $n$ different natural numbers from 1 to $n$ to obtain total control over her energy.

But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully.

Hexadecimals的数

一个美丽的七月早晨,在主机城发生了一件可怕的事情:一种恶意病毒Megabyte以某种方式获得了对他同样恶意的姐姐Hexadecimal的内存访问权限。他在那里加载了从 $1$ 到 $n$ 的 $$ 个不同自然数,以获取对她能量的完全控制。

但他的计划失败了。原因很简单:Hexadecimal除了以二进制格式写成的数字之外,不接受任何其他形式的信息。这意味着,如果十进制表示中的数字包含除0和1之外的字符,则不会存储在内存中。现在Megabyte想知道成功加载了多少个数字。

感谢[Macw](https://www.acgo.cn/person/929871)提供翻译

输入格式

Input data contains the only number $n$ ( $1<=n<=10^{9}$ ).

输入包含一个整数$n(1 \le n \le 10^9)$。

输出格式

Output the only number — answer to the problem.

输出一个整数,代表本道题的答案。

输入输出样例

输入 #1
10
输出 #1
2

说明/提示

For $n$ = 10 the answer includes numbers 1 and 10.

**请注意,本题空间限制为64MB,是默认空间限制的二分之一。**
上一题 去做题 下一题