#abc293f. [abc293_f]Zero or One

[abc293_f]Zero or One

Problem Statement

Given an integer NN not less than 22, find the number of integers bb not less than 22 such that:

  • when NN is written in base bb, every digit is 00 or 11.

Find the answer for TT independent test cases.

It can be proved that there is a finite number of desired integers bb not less than 22 under the constraints of this problem.

Constraints

  • 1leqTleq10001 \\leq T \\leq 1000
  • 2leqNleq10182 \\leq N \\leq 10^{18}
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format, where mathrmtesti\\mathrm{test}_i denotes the ii-th test case:

TT mathrmtest1\\mathrm{test}_1 mathrmtest2\\mathrm{test}_2 vdots\\vdots mathrmtestT\\mathrm{test}_T

Each test case is given in the following format:

NN

Output

Print TT lines. For i=1,2,ldots,Ti = 1, 2, \\ldots, T, the ii-th line should contain the answer to the ii-th test case.


Sample Input 1

3
12
2
36

Sample Output 1

4
1
5

For the first test case, four bb's satisfy the condition in the problem statement: b=2,3,11,12b = 2, 3, 11, 12. Indeed, when N=12N=12 is written in base 2,3,112, 3, 11, and 1212, it becomes 1100,110,111100, 110, 11 and 1010, respectively.