Alice has recently received an array a_1, a_2, ..., a_n for her birthday! She is very proud of her array, and when she showed her friend Bob the array, he was very happy with her present too!

However, soon Bob became curious, and as any sane friend would do, asked Alice to perform q operations of two types on her array:

  * 1 x y: update the element a_x to y (set a_x = y). 
  * 2 l r: calculate how many non-decreasing subarrays exist within the subarray [a_l, a_{l+1}, ..., a_r]. More formally, count the number of pairs of integers (p,q) such that l ≤ p ≤ q ≤ r and a_p ≤ a_{p+1} ≤ ... ≤ a_{q-1} ≤ a_q. 



Help Alice answer Bob's queries!

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 2 ⋅ 10^5) — the size of the array, and the number of queries, respectively.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the elements of Alice's array.

The next q lines consist of three integers each. The first integer of the i-th line is t_i, the operation being performed on the i-th step (t_i = 1 or t_i = 2).

If t_i = 1, the next two integers are x_i and y_i (1 ≤ x_i ≤ n; 1 ≤ y_i ≤ 10^9), updating the element at position x_i to y_i (setting a_{x_i} = y_i).

If t_i = 2, the next two integers are l_i and r_i (1 ≤ l_i ≤ r_i ≤ n), the two indices Bob asks Alice about for the i-th query.

It's guaranteed that there is at least one operation of the second type.

Output

For each query of type 2, print a single integer, the answer to the query.

Example

Input


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


Output


6
4
10
7

Note

For the first query, l = 2 and r = 5, and the non-decreasing subarrays [p,q] are [2,2], [3,3], [4,4], [5,5], [2,3] and [4,5].
import java.io.*;
import java.util.*;
public class a {
    public static FastScanner fs;
    public static int[]a=new int[200005];
    public static int n,q;
    static class segtree
    {
        int leftmost,rightmost,pref,suff;
        long ans;
        Boolean issorted;
        segtree left,right;
        segtree()
        {
            left=right=null;
        }
        segtree(int x)
        {
            leftmost=rightmost=x;
            pref=suff=1;
            ans=1L;
            issorted=true;
            left=right=null;
        }
        void merge()
        {
            if(left.rightmost<=right.leftmost)
            {
                issorted=(left.issorted && right.issorted);
                ans=(Long)(left.ans+right.ans)+(Long)(1L*left.suff*right.pref);
                pref=left.pref;
                if(left.issorted)
                    pref += right.pref;
                suff=right.suff;
                if(right.issorted)
                    suff += left.suff;
            }
            else
            {
                issorted=false;
                ans=(Long)(left.ans+right.ans);
                pref=left.pref;
                suff=right.suff;
            }
            leftmost=left.leftmost;
            rightmost=right.rightmost;
        }
        void update(int l,int r,int pos,int val)
        {
            if(l==r)
            {
                pref=suff=1;
                ans=1L;
                issorted=true;
                leftmost=rightmost=val;
                return;
            }
            int mid=(l+r)/2;
            if(pos<=mid)
                left.update(l,mid,pos,val);
            else
                right.update(mid+1,r,pos,val);
            merge();
        }
        segtree query(int l,int r,int s,int e)
        {
            if(s>r || e<l)
            {
                segtree x=new segtree();
                x.pref=x.suff=0;
                x.ans=0L;
                x.issorted=false;
                x.left=x.right=null;
                return x;
            }
            if(s<=l && e>=r)
                return this;
            int mid=(l+r)/2;
            segtree x=new segtree();
            x.left=left.query(l,mid,s,e);
            x.right=right.query(mid+1,r,s,e);
            x.merge();
            return x;
        }
    }
    public static segtree build(int l,int r)
    {
        if(l==r)
        {
            return new segtree(a[l]);
        }
        segtree cur=new segtree();
        int mid=(l+r)/2;
        cur.left=build(l,mid);
        cur.right=build(mid+1,r);
        cur.merge();
        return cur;
    }
    public static void main(String args[])
    {
        fs=new FastScanner();
        PrintWriter out=new PrintWriter(System.out);
        n=fs.nextInt();
        q=fs.nextInt();
        for(int i=1;i<=n;i++)
            a[i]=fs.nextInt();
        segtree root=build(1,n);
        while(q-- > 0)
        {
            int type,l,r;
            type=fs.nextInt();
            l=fs.nextInt();
            r=fs.nextInt();
            if(type==1)
            {
                root.update(1,n,l,r);
            }
            else
            {
                out.println((root.query(1,n,l,r)).ans);
            }
        }
        out.close();
    }
    static class FastScanner{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next()
        {
            if(!st.hasMoreTokens())
            {
                try{
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }
}