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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ENonDecreasingDilemma solver = new ENonDecreasingDilemma();
        solver.solve(1, in, out);
        out.close();
    }

    static class ENonDecreasingDilemma {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[] arr = in.nextIntArray(n);
            ENonDecreasingDilemma.ST s = new ENonDecreasingDilemma.ST(0, n - 1, arr);
            for (int i = 0; i < m; i++) {
                int q = in.nextInt();
                if (q == 1) {
                    int ind = in.nextInt() - 1;
                    int val = in.nextInt();
                    s.update(ind, val);
                } else {
                    int l = in.nextInt() - 1;
                    int r = in.nextInt() - 1;
                    out.println(s.query(l, r).count);
                }
            }
        }

        static class Pair {
            long count;
            long lcount;
            long rcount;
            long lval;
            long rval;
            long leftmost;
            long rightmost;

            Pair(long count, long lcount, long rcount, long lval, long rval, long leftmost, long rightmost) {
                this.count = count;
                this.lcount = lcount;
                this.rcount = rcount;
                this.lval = lval;
                this.rval = rval;
                this.leftmost = leftmost;
                this.rightmost = rightmost;
            }

        }

        static class ST {
            int leftmost;
            int rightmost;
            ENonDecreasingDilemma.ST lchild;
            ENonDecreasingDilemma.ST rchild;
            long count;
            long lval;
            long rval;
            long lcount;
            long rcount;

            public ST(int leftmost, int rightmost, int[] a) {
                this.leftmost = leftmost;
                this.rightmost = rightmost;
                if (leftmost == rightmost) {
                    //leaf
                    count = lcount = rcount = 1;
                    lval = rval = a[leftmost];
                } else {
                    // 2 children
                    int mid = (leftmost + rightmost) / 2;
                    // (l,mid) (mid+1,r)
                    lchild = new ENonDecreasingDilemma.ST(leftmost, mid, a);
                    rchild = new ENonDecreasingDilemma.ST(mid + 1, rightmost, a);
                    recalc();
                }
            }

            public void recalc() {
                if (leftmost == rightmost) return;
                lval = lchild.lval;
                rval = rchild.rval;
                if (lchild.rval <= rchild.lval) {
                    count = lchild.count + rchild.count + lchild.rcount * rchild.lcount;
                    if (lchild.lcount == lchild.rightmost - lchild.leftmost + 1) {
                        lcount = lchild.lcount + rchild.lcount;
                    }
                    if (rchild.rcount == rchild.rightmost - rchild.leftmost + 1) {
                        rcount = rchild.rcount + lchild.rcount;
                    }
                } else {
                    count = lchild.count + rchild.count;
                    lcount = lchild.lcount;
                    rcount = rchild.rcount;
                }
            }

            public void update(int index, int newVal) {
                if (leftmost == rightmost) {
                    //leaf;
                    count = lcount = rcount = 1;
                    lval = rval = newVal;
                } else {
                    // 2 children
                    if (index <= lchild.rightmost) lchild.update(index, newVal);
                    else rchild.update(index, newVal);
                    recalc();
                }
            }

            public ENonDecreasingDilemma.Pair query(int l, int r) {
                // entirely disjoint
                if (l > rightmost || r < leftmost) return new ENonDecreasingDilemma.Pair(0, 0, 0, 0, 0, l, r);
                // covers us
                if (l <= leftmost && r >= rightmost)
                    return new ENonDecreasingDilemma.Pair(count, lcount, rcount, lval, rval, leftmost, rightmost);
                // we don't know

                ENonDecreasingDilemma.Pair lc = lchild.query(l, r);
                ENonDecreasingDilemma.Pair rc = rchild.query(l, r);
                if (lc.rval > rc.lval) {
                    return new ENonDecreasingDilemma.Pair(lc.count + rc.count, lc.lcount, rc.rcount, lc.lval, rc.rval, l, r);
                } else {
                    return new ENonDecreasingDilemma.Pair(lc.count + rc.count + lc.rcount * rc.lcount, (lc.lcount == lc.rightmost - lc.leftmost + 1 ? lc.lcount + rc.lcount : lc.lcount), (rc.rcount == rc.rightmost - rc.leftmost + 1 ? rc.rcount + lc.rcount : rc.rcount), lc.lval, rc.rval, l, r);
                }
            }

        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}

