> Could you help me to solve this programming problem?

Could you help me to solve this programming problem?

Posted at: 2014-12-18 
Did you have a particular programming language in mind?

There's also an issue with your sample input. It doesn't quite match the description in the problem statement. The 5 on the first line seems to be then number of values on the second line, as described, but what's that 3 after it?

For most programming languages (C, C++, Java, C#, VB and Pascal/Delphi come to mind), code written straightforwardly according to the description will likely fail on that input.

Go to youtube .,

Let's deal with an array again, the most important data structure of computer science. You will be given an array. Now you have some operations to do. There will be three types of operations:

Type 1: Insert a number after a given index

Type 2: Change the value of an index.

Type 3: You will get a number and two indices i & j where i<=j. Now you will have to answer how many time the number appears in the array starting from i to j.

Input

Each file contains one test case.

The first line contains and integer N, the number of initial array elements(1<=N<=100000). Second line contains N integers each in the range from 1 to 100000. The third line is an integer Q(1<=Q<=100000), the number of operations. Each of the next Q lines contains an opeation. The operations will appear as the formats below:

1 x y , where 1<=x<=length of the array, which means you have to insert number y after the index x.

2 x y , For this operation, you have to change the value of index x to value y.

3 i j x , Here, you have to find how many times x appers in the array from i to j. Here x will always be present in the array and 1<=i<=j<=length the array.

Output

For each operation of 3rd type, output the required answer in separated line.

Example

Input:

5 3

42 18468 6335 26501 19170

2 4 29359

2 5 5706

3 2 5 5706

Output:

1