Flowers and Petals
75% Success33 Attempts50 Points1s Time Limit256MB Memory1024 KB Max Code

Ned has free time so he decide to play a game.In this game he take a random flower with n petals.He numbers the petals from 1 to n and pluck each petal until all the petals are fallen.He start with the first petal(petal with number 1),pluck it leaves the next and again pluck another and again leaves the next one and pluck another. He do it again an again until all the petals are plucked from the flower.

Input:

First line contains t, number of test cases.

Each t lines conatin n (number of petals).

Output:

Petal number plucked in the end of the game.

Constaints

1<=T<=10

2<=n<10^10

Examples
Input
3
7
6
10
Output
6
4
4
Explanation

For 7 petals flower

enter image description here

First he pluck the 1st petal

enter image description here

Leaves the 2nd petal and pluck 3rd petal

enter image description here

Leaves the 4th and pluck 5th petal

enter image description here

leaves 6th and pluck 7th petal

enter image description here

leaves the 2nd and pluck 4th

enter image description here

leaves 6th and pluck 2nd petal

enter image description here

at the end he pluck the 6th petal so output is 6.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading Editor...
Results