Skip to content

1335A. Candies and Two Sisters

math, 800, https://codeforces.com/problemset/problem/1335/A

There are two sisters Alice and Betty. You have 𝑛 candies. You want to distribute these 𝑛 candies between two sisters in such a way that:

  • Alice will get 𝑎 (𝑎>0) candies;
  • Betty will get 𝑏 (𝑏>0) candies;
  • each sister will get some integer number of candies;
  • Alice will get a greater amount of candies than Betty (i.e. 𝑎>𝑏);
  • all the candies will be given to one of two sisters (i.e. 𝑎+𝑏=𝑛).

Your task is to calculate the number of ways to distribute exactly 𝑛 candies between sisters in a way described above. Candies are indistinguishable.

Formally, find the number of ways to represent 𝑛n as the sum of 𝑛=𝑎+𝑏, where 𝑎a and 𝑏b are positive integers and 𝑎>𝑏.

You have to answer 𝑡 independent test cases.

Input

The first line of the input contains one integer 𝑡(1𝑡104) — the number of test cases. Then 𝑡t test cases follow.

The only line of a test case contains one integer 𝑛(1𝑛2109) — the number of candies you have.

Output

For each test case, print the answer — the number of ways to distribute exactly 𝑛n candies between two sisters in a way described in the problem statement. If there is no way to satisfy all the conditions, print 00.

Example

Input

6
7
1
2
3
2000000000
763243547

Output

3
0
0
1
999999999
381621773

Note

For the test case of the example, the 3 possible ways to distribute candies are:

  • 𝑎=6, 𝑏=1;
  • 𝑎=5, 𝑏=2;
  • 𝑎=4, 𝑏=3.
python
n = int(input())
for _ in range(n):
    n = int(input())
    if n % 2 == 0:
        print((n-2) // 2)
    else:
        print((n-1) // 2)