#P10729. [NOISG 2023 Qualification] Dolls

[NOISG 2023 Qualification] Dolls

Problem Description

Marc is teaching kindergarten children, and he chooses nesting dolls to help them understand the sizes of objects.

Each nesting doll has its own size, denoted by aa. If the sizes axa_x and aya_y of two dolls xx and yy satisfy axay2a_x-a_y\ge2, then doll yy can be put inside doll xx.

Clearly, dolls can be nested in multiple layers. So Marc wants you to answer some questions:

These questions last for nn days. On day ii, Marc buys a nesting doll of size aia_i. After buying the ii-th doll, he wants you to find the maximum number of layers that can be nested using the first ii dolls.

Input Format

The first line contains a positive integer nn.

The second line contains nn integers, representing aa.

Output Format

Output one line with nn positive integers. The ii-th integer represents the maximum number of layers that can be nested using the first ii dolls.

5
1 2 3 4 5
1 1 2 2 3
5
2 4 6 8 10

1 2 3 4 5
5
3 3 1 3 2
1 1 2 2 2

Hint

Constraints

Subtask\text{Subtask} Score Special Property
00 Sample
11 2323 n200n\le200
22 1414 aia_i is odd
33 2727 aia_i is not a multiple of 44
44 3636 None

For 100%100\% of the testdata, 1n100000,1ai5000001 \le n \le 100000,1 \le a_i \le 500000.

Translated by ChatGPT 5