CUTCAKE - Eat all the brownies !

no tags 

BrownieDude was given the job of cutting cake at a party for serving the guests. But BrownieDude is both lazy and hungry, so he wants to cut the cake into maximum number of pieces with minimum number of cuts and go off to eating brownies. 

The host of the party says that BrownieDude can cut the cake into unequal pieces but cannot cut in more than one plane.(Only vertical cuts are allowed.) Given the number of guests, find the number of cuts sufficient to generate the cake pieces.

Input

First line contains 't', the number of test cases. 't' lines follow. (1 <= t <= 1000)

Each line denotes the number of guests. (1 <= n <= 10^11)

Output

One number denoting the number of cuts.

Note: It is guaranteed that an integer solution will always exist.

Example Input:

2
1
2

Example Output:

0
1

Explanation for test cases: If there is only one guest, there is no need to cut the cake. If there are 2 guests, the cake can be cut into 2 pieces in 1 cut.


hide comments
Raman Shukla: 2014-01-06 18:51:51

The cake is circular. I hope this might help some.

Alex Velazquez: 2014-01-06 14:26:57

Can I rearrange the pieces before I make the cut?

Mitch Schwartz: 2014-01-05 20:23:41

@Fox Ninja: I've hidden your comment as it is disrespectful.

Kevin Sebastian: 2014-01-02 07:12:00

pls give tricky test cases

Chandan Singh: 2013-12-29 18:36:31

@Pandian Very good problem and my 300th problem :)

Rishabh Sharma: 2013-12-29 10:43:18

Easy one..
A/C in 1st attempt.

ritz: 2013-12-28 09:14:01

:)

J_P: 2013-12-28 09:11:31

nice one...:)

P_Quantum: 2013-12-28 08:26:51

nice prblm..!!


Added by:Pandian
Date:2013-12-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All