#d11203. 序列中位数

序列中位数

Median of the Coprime Sequence

Problem Description

Given a positive integer NN, consider the sequence formed by all integers in 1∼N−11 \sim N-1 that are coprime to NN. Find the median of this sequence.

We define the median of a sequence of length KK to be the element at position ⌊(K+1)/2⌋\lfloor (K+1)/2 \rfloor (1-indexed) when the sequence is sorted in ascending order. Two positive integers aa and bb are coprime if and only if gcd⁡(a,b)=1\gcd(a, b) = 1.

Input Format

The first line contains a positive integer TT, the number of test cases.

For each test case, the input contains one positive integer NN.

For all test cases, 1≤T≤1001 \le T \le 100, 2≤N≤10182 \le N \le 10^{18}.

Output Format

For each test case, output one line containing a single positive integer: the answer.

Sample Input

3
6
10
19

Sample Output

1
3
9