Bitwise Party

Time limit: 0.8s Memory limit: 64MB Input: Output:

The new year has come and just like all the competitive programmers, our hero Stefan received an array with positive integers as a Christmas present as well! Now he wants to explore the array and to find new interesting properties as he always likes doing.

Task

For this year, he wants to find out the maximum number of values we can take from the array such that both the bitwise AND and the bitwise XOR are different from 00.

Since this is too easy for him, he also modifies his array and wants you to answer to the same question after each update.

Input data

The input contains nn, the number of integers from the array and qq, the number of queries.

The next line contains nn integers, representing the numbers from Stefan's array.

The next qq lines contain the queries. Each query is represented by two integers, pospos and valval, representing that on the position pospos, we will change its value to valval.

Output data

The output will contain q+1q+1 lines. On the first line you will print the answer before any updates, and on the next qq lines you will print the answer after each update.

Constraints and clarifications

  • 1n,q21051 \leq n, q \leq 2 \cdot 10^5
  • 1vi,val<2201 \leq v_i, val < 2^{20}
  • For tests worth 1010 points, 1vi,val21 \leq v_i, val \leq 2.
  • For tests worth 2020 more points, 1n,q,val,vi<271 \leq n, q, val, v_i < 2^7.
  • For tests worth 2020 more points, 1n,q,val,vi<2101 \leq n, q, val, v_i < 2^{10}.

Example 1

stdin

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

stdout

3
3
4
5
4
3
4
3
4

Log in or sign up to be able to send submissions!