cswork / OAOpen practice workspace

JPMorgan ChaseOA #6

Choosing a Fleet of Vehicles

Estimated EasyJudge-ready

Topics (AI-labelled)Bits & Math

Each query gives a total number of wheels; form a fleet from unlimited two-wheeled and four-wheeled vehicles. Two options are different only if the number of vehicles of some type differs; arrangements are not counted.

Input

The first line contains n, followed by n values of wheels; 1≤n≤100000, 1≤wheels[i]≤1000000.

Output

Output n lines with the number of options, in input order.

Example 1

Input:

3
4 5 6

Output:

2
0
2

Example 2

Input:

3
1 2 3

Output:

0
1
0

Example 3

Input:

3
8 10 12

Output:

3
3
4

Example notes

The outputs of the three public examples are, in order: 2 / 0 / 2; 0 / 1 / 0; 3 / 3 / 4. These answers have been checked by independent enumeration or direct simulation.

Editorial

Loading solution…