401937: GYM100589 E Count Distinct Sets
Description
Alice writes a permutation P1, P2, P3, ... PN of [1, 2, 3, ...N]. A permutation that follows the condition:
Pi > Pi / 2 for all i = 2 to N, is assumed to be an ‘amusing’ permutation. Note that / denotes integer division.
Alice wrote down all ‘amusing’ permutations on a sheet of paper. For each number from i = 1 to N, she defines a set Si. A number j belongs to Si if number i was at j’th position in at-least one of the ‘amusing’ permutations.
You have to find how many distinct Si exist for i = 1 to N.
InputFirst line contains T, the number of test cases. Each test case consists of N in single line.
OutputFor each test case, print the required answer in one line.
Constraints
- 1 ≤ T ≤ 104
- 1 ≤ N ≤ 1018
2Output
2
3
2Note
2
Example 1. Only ‘amusing’ permutations is [1, 2]. [2, 1] is not an ‘amusing’ permutation because P2 < P2 / 2.
S1 is defined as {1} since 1 only occurs at first position in all ‘amusing’ permutations. Similarly S2 is defined as {2}.
Therefore 2 distinct sets are possible ie. {1} and {2}.
Example 2. All ‘amusing’ permutations are: [1, 2, 3] and [1, 3, 2].
S1 is defined as {1} since 1 only occurs at first position in all ‘amusing’ permutations. Similarly S2 is defined as {2, 3} and S3 is also defined as {2, 3}.
So a total of 2 distinct sets {1} and {2, 3} are possible.