Chris is learning about segment tree beats and decided to make a template problem about it. You are given an array of length and queries.
1 l r x
: Determine how many where
2 l r x
: for , becomes
3 l r x
: for , becomes
Input Specification
The first line of input contains two integers .
The next line contains integers .
The next lines contain a query as described above. For all queries, and .
Output Specification
For each query of type 1
, you are to output the answer on one line.
Subtasks
Subtask 1 (5%)
Subtask 2 (95%)
No further constraints.
Sample Input
5 5
1 2 3 4 5
1 2 3 3
3 2 4 50002
1 1 5 1
2 1 3 1
1 1 4 2
Sample Output
1
2
3
Comments