Patchouli's magic library contains books, where each book has a label
to keep things organized. Due to the overwhelmingly large amount of books, Patchouli asks you to help her keep track of the book's labels as she does
operations in the library.
The operations are of the following types :
- Set the label of all books from book
to book
, inclusive, to
.
- Query the number of books with a label equal to
from book
to book
, inclusive.
Constraints
Subtask 1 [2/15]
Subtask 2 [6/15]
for all queries of type
.
Subtask 3 [7/15]
No additional constraints.
Input Specification
The first line of input contains space separated integers,
and
, the number of books and the number of operations respectively.
The second line of input contains space separated integers,
, the label of each book in order.
The next lines of input contains
integers each,
,
,
, and
, the parameters for each operation.
Output Specification
For each type operation, output
integer on its own line, the answer to that query.
Sample Input
6 5
1 4 3 4 6 6
2 2 4 4
1 2 4 1
2 1 6 1
1 4 5 5
2 1 6 6
Sample Output
2
4
1
Explanation for Sample Output
In the first operation, the queried books have labels ,
of which have a label equal to
.
In the second operation, the book's labels become .
Comments