Recently, SPY has retired from XCPC. He cherishes the memory of learning algorithms from scratch and winning the ICPC gold medal. So he is finding an NPY (non-programming youth) to be his successor. SPY is so popular that �n NPYs want to be his apprentice. As SPY only needs one NPY, he sets a test for the �n NPYs. The rules are as follows:
�n NPYs are indexed from 11 to �n. SPY will interview the �n NPYs in order. The �i-th NPY will be tested in the �i-th interview. After an NPY is interviewed, SPY will get her IQ (intelligence quotient) number (an integer in [0,202320232023][0,202320232023]) . SPY can decide whether to accept her or not. Once he accepts an NPY, the test would be finished and he won't interview the following NPYs. Once he refuses an NPY, he won't give her another chance.
Notice that there are no two NPYs with the same IQ. SPY has a specital strategy to find an NPY with high IQ. He sets an integer �k (0≤�<�)(0≤k<n) before the test.
1、No matter how intelligent the first �k NPYs are, they will be refused. SPY will record the highest IQ number �x within the first �k NPYs. If �=0k=0 then �=−1x=−1.
2、Then he will interview the (�+1)(k+1)-th to the (�−1)(n−1)-th NPY. Once SPY interviews an NPY with IQ higher than �x, he will accept her and finish the test.
3、If no NPY is accepted, SPY will accept the �n-th NPY.
The IQ rank of the �n NPYs is random, which means their rank is a permutation of 1∼�1∼n, and the �!n! possible situations occur with equal probability. Althouth SPY is a master of useful algorithms, it is difficult for him to set the number �k. Can you help him to calculate the minimum �k to maximize the probability to accept the NPY with the highest IQ?
The first line contains a single integer �T (1≤�≤104)(1≤T≤104), indicating the number of test cases.
The next �T lines, each line contains a single integer �n (1≤�≤104)(1≤n≤104), indicating the number of NPYs.
8
1
2
3
4
9000
9001
9002
9003
0
0
1
1
3311
3311
3311
3312
In the third test, there are 33 NPYs. Let the array �p represent to the IQ rank. The IQ rank of �i-th NPY is ��pi. The �u-th NPY with ��=1pu=1 has the lowest IQ, and the �v-th NPY with ��=3pv=3 has the highest IQ.
There are 3!=63!=6 situations occur with equal probability. The following list shows the IQ rank of the accepted NPY in all situations, and the probability to accept the NPY with the highest IQ.