You are given an array aa of nn elements. You can apply the following operation to it any number of times:
- Select some subarray from aa of even size 2k2k that begins at position ll (1≤l≤l+2⋅k−1≤n1≤l≤l+2⋅k−1≤n, k≥1k≥1) and for each ii between 00 and k−1k−1 (inclusive), assign the value al+k+ial+k+i to al+ial+i.
For example, if a=[2,1,3,4,5,3]a=[2,1,3,4,5,3], then choose l=1l=1 and k=2k=2, applying this operation the array will become a=[3,4,3,4,5,3]a=[3,4,3,4,5,3].
Find the minimum number of operations (possibly zero) needed to make all the elements of the array equal.
Input
The input consists of multiple test cases. The first line contains a single integer tt (1≤t≤2⋅1041≤t≤2⋅104) — the number of test cases. Description of the test cases follows.
The first line of each test case contains an integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the length of the array.
The