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.util.*;

import java.io.*;
import java.math.*;
public class B

{ 
	 static FastReader sc=new FastReader();
	 static long dp[][];
	 static int mod=1000000007;
	 static int max;
	 static long bit[];
	 static int in[];
	 static int ot[];
	 static int timer=1;
	 static Pair seg[];
	 static int A[];
	 static HashMap<Integer,Integer> map;
		  public static void main(String[] args) 
    {
			//CHECK FOR N=1
		       	//CHECK FOR N=1
		  PrintWriter out=new PrintWriter(System.out);
		 // StringBuffer sb=new StringBuffer("");
		  int ttt=1;
		   // ttt =i(); 
	       outer: while (ttt-- > 0) 
			{
	    	   int n=i();
	    	   int q=i();
	    	   A=new int[n+1];
	    	   for(int i=1;i<=n;i++) {
	    		   A[i]=i();
	    	   }
	    	  seg=new Pair[5*n];
	    	  for(int i=0;i<seg.length;i++) {
	    		  seg[i]=new Pair();
	    	  }
	    	  build(1, 1, n);
	    	  while(q-->0) {
	    		  int t=i();
	    		  int l=i();
	    		  int r=i();
	    		  if(t==1) {
	    			  A[l]=r;
	    			  update(1, 1, n, l);
	    		  }
	    		  else {
	    			  out.println(query(1, 1, n, l, r).ans);
	    		  }
	    		  
	    	  }
	    	  
	       
	    	  
	    	   

	   		 
	        	
			}
		  out.close();
	        	//System.out.println(sb.toString());
		    
		    //CHECK FOR N=1                    //CHECK FOR M=0
	        //CHECK FOR N=1                    //CHECK FOR M=0
	       	
    }
		  
		  
		  
		  
		  static void build(int si , int ss , int se)
		  {
		  	if(ss == se)
		  	{
		  		seg[si].l=seg[si].r= A[ss];
		  		seg[si].ans=1;
		  		seg[si].le=seg[si].ls=seg[si].rs=seg[si].re=ss;
		  		return ;
		  	}
		   
		  	int mid = (ss + se) / 2;
		  	build(2*si , ss , mid);
		  	build(2*si+1 ,mid+1 , se);
		   
		  //	seg[si] = seg[2*si] ^ seg[2*si+1];
		  	if(seg[2*si].r>seg[2*si+1].l) {
		  		seg[si].l=seg[2*si].l;
		  		seg[si].le=seg[2*si].le;
		  		seg[si].ls=seg[2*si].ls;
		  		seg[si].ans=seg[2*si].ans+seg[2*si+1].ans;
		  		seg[si].r=seg[2*si+1].r;
		  		seg[si].re=seg[2*si+1].re;
		  		seg[si].rs=seg[2*si+1].rs;
		  	}
		  	else {
		  		seg[si].l=seg[2*si].l;
		  		seg[si].le=seg[2*si].le;
		  		seg[si].ls=seg[2*si].ls;
		  		seg[si].ans=seg[2*si].ans+seg[2*si+1].ans+(long)(Math.abs(seg[2*si+1].le-seg[2*si+1].ls)+1)*(Math.abs(seg[2*si].re-seg[2*si].rs)+1);
		  		seg[si].r=seg[2*si+1].r;
		  		seg[si].re=seg[2*si+1].re;
		  		seg[si].rs=seg[2*si+1].rs;
		  		if(seg[2*si].le==seg[2*si].re) {
		  			seg[si].le=seg[2*si+1].le;
		  		}
		  		if(seg[2*si+1].rs==seg[2*si+1].ls) {
		  			seg[si].rs=seg[2*si].rs;
		  		}
		  		
		  	}
		  }
		  static void update(int si,int ss,int se,int qi) {
			  if(ss == se)
			  	{
//			  		seg[si] = A[ss];
//			  		return ;
				  seg[si].l=seg[si].r= A[ss];
			  		seg[si].ans=1;
			  		seg[si].le=seg[si].ls=seg[si].rs=seg[si].re=ss;
			  		return ;
			  	}
			   
			  	int mid = (ss + se) / 2;
			  	if(qi<=mid) {
			  	update(2*si , ss , mid,qi);
			  	}
			  	else {
			  	update(2*si+1 ,mid+1 , se,qi);
			  	}
			  	if(seg[2*si].r>seg[2*si+1].l) {
			  		seg[si].l=seg[2*si].l;
			  		seg[si].le=seg[2*si].le;
			  		seg[si].ls=seg[2*si].ls;
			  		seg[si].ans=seg[2*si].ans+seg[2*si+1].ans;
			  		seg[si].r=seg[2*si+1].r;
			  		seg[si].re=seg[2*si+1].re;
			  		seg[si].rs=seg[2*si+1].rs;
			  	}
			  	else {
			  		seg[si].l=seg[2*si].l;
			  		seg[si].le=seg[2*si].le;
			  		seg[si].ls=seg[2*si].ls;
			  		seg[si].ans=seg[2*si].ans+seg[2*si+1].ans+(long)(seg[2*si+1].le-seg[2*si+1].ls+1)*(seg[2*si].re-seg[2*si].rs+1);
			  		seg[si].r=seg[2*si+1].r;
			  		seg[si].re=seg[2*si+1].re;
			  		seg[si].rs=seg[2*si+1].rs;
			  		if(seg[2*si].le==seg[2*si].re) {
			  			seg[si].le=seg[2*si+1].le;
			  		}
			  		if(seg[2*si+1].rs==seg[2*si+1].ls) {
			  			seg[si].rs=seg[2*si].rs;
			  		}
			  		
			  	}
			  	//seg[si] = max(seg[2*si] , seg[2*si+1]);
		  }
		  static Pair query(int si , int ss , int se , int qs , int qe)
		  {
		  	if(ss > qe || se < qs) return null;
		   
		  	if(ss >= qs && se <= qe) return seg[si];
		   
		  	int mid = (ss + se) / 2;
		   
		  	Pair p1=query(2*si , ss , mid , qs , qe);
		  	Pair p2=query(2*si+1 , mid+1 , se , qs , qe);
		  	if(p1==null)
		  		return p2;
		  	if(p2==null)
		  		return p1;
		  	Pair p3=new Pair();
		  	if(p1.r>p2.l) {
		  		p3.l=p1.l;
		  		p3.le=p1.le;
		  		p3.ls=p1.ls;
		  		p3.ans=p1.ans+p2.ans;
		  		p3.r=p2.r;
		  		p3.re=p2.re;
		  		p3.rs=p2.rs;
		  	}
		  	else {
		  		p3.l=p1.l;
		  		p3.le=p1.le;
		  		p3.ls=p1.ls;
		  		p3.ans=p1.ans+p2.ans+(long)(p2.le-p2.ls+1)*(p1.re-p1.rs+1);
		  		p3.r=p2.r;
		  		p3.re=p2.re;
		  		p3.rs=p2.rs;
		  		if(p1.le==p1.re) {
		  			p3.le=p2.le;
		  		}
		  		if(p2.rs==p2.ls) {
		  			p3.rs=p1.rs;
		  		}
		  }
		  	return p3;
		  }
		  
		 
			
		  
		  



static class Pair// implements Comparable<Pair>
     {
    	 int l;
    	 int ls;
    	 int le;
    	 int r;
    	 int rs;
    	 int re;
    	 long ans;
//    	 Pair(int x,int y){
//    		 this.x=x;
//    		 this.y=y;
//    		 
//    	 }
//		@Override
//		public int compareTo(Pair o) {
//			if(this.x>o.x)
//				return 1;
//			else if(this.x<o.x)
//				return -1;
//			else {
//				if(this.y>o.y)
//					return 1;
//				else if(this.y<o.y)
//					return -1;
//				else
//					return 0;
//			}
//		}
		
		/* FOR TREE MAP PAIR USE */
		
//		public int compareTo(Pair o) {
// 			if (x > o.x) {
// 				return 1;
// 			}
// 			if (x < o.x) {
// 				return -1;
// 			}
// 			if (y > o.y) {
// 				return 1;
// 			}
// 			if (y < o.y) {
// 				return -1;
// 			}
// 			return 0;
// 		}
//		public int hashCode() 
//		{ 
//			final int temp = 14; 
//			int ans = 1; 
//			ans =x*31+y*13; 
//			return ans; 
//		} 
  
		// Equal objects must produce the same 
		// hash code as long as they are equal 
		//@Override
//		public boolean equals(Object o) 
//		{ 
//			if (this == o) { 
//				return true; 
//			} 
//			if (o == null) { 
//				return false; 
//			} 
//			if (this.getClass() != o.getClass()) { 
//				return false; 
//			} 
//			Pair other = (Pair)o; 
//			if (this.x != other.x || this.y!=other.y) { 
//				return false; 
//			} 
//			return true; 
//		} 	
//		
     }
//FRENWICK TREE
//static void update(int i, int x){
//	for(; i < bit.length; i += (i&-i))
//		bit[i] += x;
//}

//static int sum(int i){
//	int ans = 0;
//	for(; i > 0; i -= (i&-i))
//		ans += bit[i];
//	return ans;
//}
//END
static void add(int v) {
	if(!map.containsKey(v)) {
		map.put(v, 1);
	}
	else {
		map.put(v, map.get(v)+1);
	}
}
static void remove(int v) {
	if(map.containsKey(v)) {
		map.put(v, map.get(v)-1);
		if(map.get(v)==0)
			map.remove(v);
	}
}
static int[] copy(int A[]) {
	int B[]=new int[A.length];
	for(int i=0;i<A.length;i++) {
		B[i]=A[i];
	}
	return B;
}
static long[] copy(long A[]) {
	long B[]=new long[A.length];
	for(int i=0;i<A.length;i++) {
		B[i]=A[i];
	}
	return B;
}
static int[] input(int n) {
	int A[]=new int[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.nextInt();
	   }
	   return A;
   }
static long[] inputL(int n) {
	long A[]=new long[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.nextLong();
	   }
	   return A;
   }
static String[] inputS(int n) {
	String A[]=new String[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.next();
	   }
	   return A;
   }
static long sum(int A[]) {
	long sum=0;
	for(int i : A) {
		sum+=i;
	}
	return sum;
}
static long sum(long A[]) {
	long sum=0;
	for(long i : A) {
		sum+=i;
	}
	return sum;
}
static void reverse(long A[]) {
	int n=A.length;
	long B[]=new long[n];
	for(int i=0;i<n;i++) {
		B[i]=A[n-i-1];
	}
	for(int i=0;i<n;i++)
		A[i]=B[i];
	
}
static void reverse(int A[]) {
	int n=A.length;
	int B[]=new int[n];
	for(int i=0;i<n;i++) {
		B[i]=A[n-i-1];
	}
	for(int i=0;i<n;i++)
		A[i]=B[i];
	
}
static void input(int A[],int B[]) {
	   for(int i=0;i<A.length;i++) {
		   A[i]=sc.nextInt();
		   B[i]=sc.nextInt();
	   }
}
static int[][] input(int n,int m){
	int A[][]=new int[n][m];
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			A[i][j]=i();
		}
	}
	return A;
}
static char[][] charinput(int n,int m){
	char A[][]=new char[n][m];
	for(int i=0;i<n;i++) {
		String s=s();
		for(int j=0;j<m;j++) {
			A[i][j]=s.charAt(j);
		}
	}
	return A;
}
static int find(int A[],int a) {
	  if(A[a]==a)
		  return a;
	  return A[a]=find(A, A[a]);
}
static int max(int A[]) {
	int max=Integer.MIN_VALUE;
	for(int i=0;i<A.length;i++) {
		max=Math.max(max, A[i]);
	}
	return max;
}
static int min(int A[]) {
	int min=Integer.MAX_VALUE;
	for(int i=0;i<A.length;i++) {
		min=Math.min(min, A[i]);
	}
	return min;
}
static long max(long A[]) {
	long max=Long.MIN_VALUE;
	for(int i=0;i<A.length;i++) {
		max=Math.max(max, A[i]);
	}
	return max;
}
static long min(long A[]) {
	long min=Long.MAX_VALUE;
	for(int i=0;i<A.length;i++) {
		min=Math.min(min, A[i]);
	}
	return min;
}
static long [] prefix(long A[]) {
	long p[]=new long[A.length];
	p[0]=A[0];
	for(int i=1;i<A.length;i++)
		p[i]=p[i-1]+A[i];
	return p;
}
static long [] prefix(int A[]) {
	long p[]=new long[A.length];
	p[0]=A[0];
	for(int i=1;i<A.length;i++)
		p[i]=p[i-1]+A[i];
	return p;
}
static long [] suffix(long A[]) {
	long p[]=new long[A.length];
	p[A.length-1]=A[A.length-1];
	for(int i=A.length-2;i>=0;i--)
		p[i]=p[i+1]+A[i];
	return p;
}
static long [] suffix(int A[]) {
	long p[]=new long[A.length];
	p[A.length-1]=A[A.length-1];
	for(int i=A.length-2;i>=0;i--)
		p[i]=p[i+1]+A[i];
	return p;
}
static void fill(int dp[]) {
	Arrays.fill(dp, -1);
}
static void fill(int dp[][]) {
	for(int i=0;i<dp.length;i++)
	Arrays.fill(dp[i], -1);
}
static void fill(int dp[][][]) {
	for(int i=0;i<dp.length;i++) {
		for(int j=0;j<dp[0].length;j++) {
			Arrays.fill(dp[i][j],-1);
		}
	}
}
static void fill(int dp[][][][]) {
	for(int i=0;i<dp.length;i++) {
		for(int j=0;j<dp[0].length;j++) {
			for(int k=0;k<dp[0][0].length;k++) {
			Arrays.fill(dp[i][j][k],-1);
			}
		}
	}
}
static void fill(long dp[]) {
	Arrays.fill(dp, -1);
}
static void fill(long dp[][]) {
	for(int i=0;i<dp.length;i++)
	Arrays.fill(dp[i], -1);
}
static void fill(long dp[][][]) {
	for(int i=0;i<dp.length;i++) {
		for(int j=0;j<dp[0].length;j++) {
			Arrays.fill(dp[i][j],-1);
		}
	}
}
static void fill(long dp[][][][]) {
	for(int i=0;i<dp.length;i++) {
		for(int j=0;j<dp[0].length;j++) {
			for(int k=0;k<dp[0][0].length;k++) {
			Arrays.fill(dp[i][j][k],-1);
			}
		}
	}
}
static int min(int a,int b) {
	return Math.min(a, b);
}
static int min(int a,int b,int c) {
	return Math.min(a, Math.min(b, c));
}
static int min(int a,int b,int c,int d) {
	return Math.min(a, Math.min(b, Math.min(c, d)));
}
static int max(int a,int b) {
	return Math.max(a, b);
}
static int max(int a,int b,int c) {
	return Math.max(a, Math.max(b, c));
}
static int max(int a,int b,int c,int d) {
	return Math.max(a, Math.max(b, Math.max(c, d)));
}
static long min(long a,long b) {
	return Math.min(a, b);
}
static long min(long a,long b,long c) {
	return Math.min(a, Math.min(b, c));
}
static long min(long a,long b,long c,long d) {
	return Math.min(a, Math.min(b, Math.min(c, d)));
}
static long max(long a,long b) {
	return Math.max(a, b);
}
static long max(long a,long b,long c) {
	return Math.max(a, Math.max(b, c));
}
static long max(long a,long b,long c,long d) {
	return Math.max(a, Math.max(b, Math.max(c, d)));
}

static long power(long x, long y, long p)
{

	if(y==0)
		return 1;
	if(x==0)
		return 0;
    long res = 1;
    x = x % p;

    while (y > 0) {

        if (y % 2 == 1)
            res = (res * x) % p;

        y = y >> 1; 
        x = (x * x) % p;
    }

    return res;
}
static void print(int A[]) {
	for(int i : A) {
		System.out.print(i+" ");
	}
	System.out.println();
}
static void print(long A[]) {
	for(long i : A) {
		System.out.print(i+" ");
	}
	System.out.println();
}
static long mod(long x) {
	  return ((x%mod + mod)%mod);
}
static String reverse(String s) {
	StringBuffer p=new StringBuffer(s);
	p.reverse();
	return p.toString();
}

     static int i() {
    	 return sc.nextInt();
     }
     static String s() {
    	 return sc.next();
     }
     static long l() {
    	 return sc.nextLong();
     }  
     static void sort(int[] A){
        int n = A.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = A[i];
            int randomPos = i + rnd.nextInt(n-i);
            A[i] = A[randomPos];
            A[randomPos] = tmp;
        }
        Arrays.sort(A);
     }
     static void sort(long[] A){
	        int n = A.length;
	        Random rnd = new Random();
	        for(int i=0; i<n; ++i){
	            long tmp = A[i];
	            int randomPos = i + rnd.nextInt(n-i);
	            A[i] = A[randomPos];
	            A[randomPos] = tmp;
	        }
	        Arrays.sort(A);
	     }
  static String sort(String s) {
 	 Character ch[]=new Character[s.length()];
 	 for(int i=0;i<s.length();i++) {
 		 ch[i]=s.charAt(i);
 	 }
 	 Arrays.sort(ch);
 	 StringBuffer st=new StringBuffer("");
 	 for(int i=0;i<s.length();i++) {
 		 st.append(ch[i]);
 	 }
 	 return st.toString();
  }
  static HashMap<Integer,Integer> hash(int A[]){
	  HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();
	  for(int i : A) {
		  if(map.containsKey(i)) {
			  map.put(i, map.get(i)+1);
		  }
		  else {
			  map.put(i, 1);
		  }
	  }
	  return map;
  }
  static TreeMap<Integer,Integer> tree(int A[]){
	  TreeMap<Integer,Integer> map=new TreeMap<Integer, Integer>();
	  for(int i : A) {
		  if(map.containsKey(i)) {
			  map.put(i, map.get(i)+1);
		  }
		  else {
			  map.put(i, 1);
		  }
	  }
	  return map;
  }
     static boolean prime(int n) 
	    { 
	        if (n <= 1) 
	            return false; 
	        if (n <= 3) 
	            return true; 
	        if (n % 2 == 0 || n % 3 == 0) 
	            return false; 
	        double sq=Math.sqrt(n);
	  
	        for (int i = 5; i <= sq; i = i + 6) 
	            if (n % i == 0 || n % (i + 2) == 0) 
	                return false; 
	        return true; 
	    } 
     static boolean prime(long n) 
	    { 
	        if (n <= 1) 
	            return false; 
	        if (n <= 3) 
	            return true; 
	        if (n % 2 == 0 || n % 3 == 0) 
	            return false; 
	        double sq=Math.sqrt(n);
	  
	        for (int i = 5; i <= sq; i = i + 6) 
	            if (n % i == 0 || n % (i + 2) == 0) 
	                return false; 
	        return true; 
	    } 
     static int gcd(int a, int b) 
     { 
         if (a == 0) 
             return b; 
         return gcd(b % a, a); 
     } 
     static long gcd(long a, long b) 
     { 
         if (a == 0) 
             return b; 
         return gcd(b % a, a); 
     } 
     
        
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
} 
