Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2014-03-30 20:30:00.
Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

BINCNT - Binary Counting

You have to solve a simple problem. You will be given a positive integer 'N'. You need to count such positive integer less than or equal to N which contains only binary bits (i.e it just contains '0' or '1' or both). For e.g, 10, 101, 110, etc should be counted while 12, 20, 215 etc shouldn't be counted.

Input

The first line of the input will contain T (1 <= T <= 1000), the number of test cases.

Then T lines will follow, each containing a positive integer N. (1 <= N <= 1000000000).

Output

Output T lines, each containing the answer of each test cases.

Example

Input:
2
10
20
Output:
2
3

Added by:Tarang Patel
Date:2014-03-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM32-GCC ASM64 MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Public source code since: 2014-03-30 20:30:00

hide comments
2014-03-27 15:05:06 shashank
@JigarSharda : 1 and 10 ..
All the number which contain digit '1' or '0' ..
2014-03-27 13:25:48 Jigar Sharda
for 10. How is it 2 ?
other than 1 which other number ? :O
2014-03-27 09:23:26 shashank
@BerwaniManish 0 is not a positive integer.
2014-03-27 09:19:36 shyamelc
for 20 : 0, 1 ,10, 11

there are four outputs.........plz explain
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.