AT_arc203_d [ARC203D] Insert XOR
Description
There is an integer sequence $ A=(A_1,A_2,\dots,A_N) $ of length $ N $ consisting of $ 0 $ and $ 1 $ . You are given $ Q $ queries. The $ q $ -th query is as follows:
- An integer $ i_q $ between $ 1 $ and $ N $ is given. Change $ A_{i_q} $ to $ 1 $ if it is $ 0 $ , and to $ 0 $ if it is $ 1 $ .
After processing each query, find the answer to the following problem:
> Consider sequences $ B=(B_1,B_2,\dots,B_{|B|}) $ consisting of $ 0 $ and $ 1 $ that satisfy the following condition:
>
> - By performing the following operation any number of times on $ B $ , it can be made to match sequence $ A $ :
> - Choose an integer $ i $ between $ 1 $ and $ |B|-1 $ , inclusive.
> - Insert $ B_i\oplus B_{i+1} $ between $ B_i $ and $ B_{i+1} $ .
>
> It can be proved that there always exists a $ B $ that satisfies the condition. Find the minimum possible value of $ |B| $ .
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $ $ Q $ $ i_1 $ $ i_2 $ $ \vdots $ $ i_Q $
Output Format
Output the answers in a total of $ Q $ lines. The $ q $ -th line should contain the answer to the problem after processing the $ q $ -th query.
Explanation/Hint
### Sample Explanation 1
When $ A=(1,0,0) $ , $ |B| $ is minimized by $ B=(1,0,0) $ . When $ A=(1,1,0) $ , $ |B| $ is minimized by $ B=(1,0) $ .
### Constraints
- $ 3 \leq N \leq 2 \times 10^5 $
- $ 0 \leq A_i \leq 1 $
- $ 1 \leq Q \leq 5 \times 10^5 $
- $ 1 \leq i_q \leq N $
- All input values are integers.