Given a sequence of integers a1,…,ana_1,\dots,a_na1,…,an , you need to process mmm operations.
In an operation l,r,xl,r,xl,r,x , you need to update the sequence first, and then query how many different values are there in a1,…,axa_1,\dots,a_xa1,…,ax .
When l≤rl\le rl≤r , the update is sort al,…,ara_l,\dots,a_ral,…,ar according to ascending order, or the update is sort ar,…,ala_r,\dots,a_lar,…,al according to descending order.
The first line contains two integers n,mn,mn,m .
The next line contains nnn integers a1,…,ana_1,\dots,a_na1,…,an .
For the next mmm lines, each line contains three integers l⊕c,r⊕c,x⊕cl\oplus c,r\oplus c,x\oplus cl⊕c,r⊕c,x⊕c , means an operation l,r,xl,r,xl,r,x. Where ⊕\oplus⊕ is bitwise XOR, and ccc is the answer to the last operation (especially, c=0c=0c=0 for the first operation).
输出格式
For each operation, output an integer in a line representing the answer.