Hudson River TradingOA #3
Count Fancy Numbers
估计中等可在线判题
考点(AI 标注)位运算
A positive integer is called fancy if its base-4 representation contains only the digits 0 and 1. Given n, count the positive fancy integers strictly less than n; 0 is not counted.
输入格式
The input is one integer n (1≤n≤10^9).
输出格式
Output the number of positive integers that satisfy the condition.
样例 1
输入:
1
输出:
0
样例 2
输入:
10
输出:
3
样例 3
输入:
17
输出:
4