P16495 An Outing on the Southern Path, a Journey Far and Wide

Background

In the beautiful season of spring, you must go out for an outing!

Description

zxh is going to go on an outing. At the beginning, zxh does not know any scenic spots. zxh will search $q$ times in total, finding one scenic spot each time. Each scenic spot is represented by an $n$-bit binary number $a_i$ indicating which sceneries it contains; $a_i$ can be $0$. (The input uses decimal notation.) zxh will arrange several outings, and each outing visits several scenic spots in order (the same scenic spot may be visited more than once). In one outing, if two consecutively visited scenic spots $u$ and $v$ satisfy $a_u \;\text{or}\; a_v = 2^n - 1$ (i.e. their bitwise OR contains all $n$ kinds of scenery), then this outing is "not worth looking forward to". zxh will not arrange outings that are not worth looking forward to. Therefore, any two adjacent scenic spots in one outing must satisfy $a_u \;\text{or}\; a_v \neq 2^n - 1$. After each search (i.e. after obtaining the first $k$ scenic spots), zxh wants to know: at least how many outings must be arranged so that every scenic spot searched so far is visited at least once. Note that there is no ordering requirement between different outings, and each outing can independently choose its sequence of scenic spots. You need to output this minimum number of outings after each search.

Input Format

The first line contains two integers $n,q$. Each of the next $q$ lines contains a number $a_i$, the scenic spot found.

Output Format

There are $q$ lines in total, each containing an integer: the answer after the insertion.

Explanation/Hint

For the fourth query, after obtaining the new scenic spot $a_i=6$, $3 \to 1 \to 5$ forms one outing; $6$ alone forms one outing (note that a single scenic spot can also be an outing), so the answer is $2$. --- ::cute-table{tuack} |Subtask No.|$q\le$|Special property|Points| |:--------:|:--:|:--------:|:-:| |#1|$15$|none| $2$ | |#2|$10^3$|^| $7$ | |#3|$10^5$|^| $23$ | |#4|$5 \times 10^5$|A| $15$ | |#5|^|none| $53$ | Special property A: $n \le 2$. For $100\%$ of the data, $1 \le n \le 60$, $0 \le a_i \le 2^n-1$, $1 \le q \le 5 \times 10^5$. Translated by QwenWork