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

public class Main {

    static final int INF = 0x3f3f3f3f;
    static final long LNF = 0x3f3f3f3f3f3f3f3fL;

    public static void main(String[] args) throws IOException {

        initReader();


//        int T = nextInt();
//        for (int i = 1; i <= T; i++)
        solve();


        pw.flush();
    }

    /*******************************************************************************************************************************/


    public static void solve() throws IOException {
        int n = nextInt();
        int q = nextInt();

        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++) a[i] = nextInt();

        SegmentTree tree = new SegmentTree(a, n);
        while (q-- > 0) {
            int op = nextInt();

            if (op == 1) {
                int x = nextInt();
                int y = nextInt();
                tree.update(x, y, 1, n, 1);
            } else {
                int l = nextInt();
                int r = nextInt();
                pw.println(tree.query(l, r, 1, n, 1).value);
            }
        }
    }



    public static <T> void deBug(T... a) {
        System.out.println(Arrays.toString(a));
    }


    /*******************************************************************************************************************************/

    static class SegmentTree {
        SegmentTreeNode[] C;

        public SegmentTree(int[] arr, int n) {
            C = new SegmentTreeNode[(n + 1) << 2];
            build(arr, 1, n, 1);
        }

        public void pushUp(int root) {
            pushUp(C[root], C[root << 1], C[root << 1 | 1]);
        }

        public void pushUp(SegmentTreeNode node, SegmentTreeNode left, SegmentTreeNode right) {
            node.value = left.value + right.value;
            node.first = left.first;
            node.last = right.last;
            node.pre = left.pre;
            node.suf = right.suf;

            if (left.last <= right.first) {
                node.value += left.suf * right.pre;
                if (left.suf == left.len) node.pre = left.len + right.pre;
                if (right.pre == right.len) node.suf = left.suf + right.len;
            }
        }

        public void setNode(SegmentTreeNode node, int v) {
            node.first = v;
            node.last = v;
            node.value = 1;
            node.pre = 1;
            node.suf = 1;
        }

        public void build(int[] arr, int l, int r, int root) {
            C[root] = new SegmentTreeNode(0, 0, 0, 0, 0, r - l + 1);
            if (l == r) {
                setNode(C[root], arr[l]);
                return ;
            }

            int mid = l + r >> 1;
            build(arr, l, mid, root << 1);
            build(arr, mid + 1, r, root << 1 | 1);
            pushUp(root);
        }

        public void update(int k, int v, int l, int r, int root) {
            if (l == r) {
                setNode(C[root], v);
                return;
            }

            int mid = l + r >> 1;
            if (k <= mid) update(k, v, l, mid, root << 1);
            else update(k, v, mid + 1, r, root << 1 | 1);
            pushUp(root);
        }

        public SegmentTreeNode query(int L, int R, int l, int r, int root) {
            if (L <= l && r <= R) {
                return C[root];
            }

            int mid = l + r >> 1;
            if (R <= mid) return query(L, R, l, mid, root << 1);
            else if (L > mid) return query(L, R, mid + 1, r, root << 1 | 1);
            else {
                SegmentTreeNode left = query(L, R, l, mid, root << 1);
                SegmentTreeNode right = query(L, R, mid + 1, r, root << 1 | 1);
                SegmentTreeNode node = new SegmentTreeNode(0, 0, 0, 0, 0, r - l + 1);
                pushUp(node, left, right);
                return node;
            }
        }
    }

    static class SegmentTreeNode {
        long value;
        int first;
        int last;
        long pre;
        long suf;
        int len;

        /**
         *
         * @param value 该区间中非递减子数组的个数
         * @param first 区间中第一个数
         * @param last  区间中最后一个数
         * @param pre   最长非递减前缀
         * @param suf   最长非递减后缀
         * @param len   区间长度
         */
        public SegmentTreeNode(long value, int first, int last, long pre, long suf, int len) {
            this.value = value;
            this.first = first;
            this.last = last;
            this.pre = pre;
            this.suf = suf;
            this.len = len;
        }
    }

    /*******************************************************************************************************************************/

    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static PrintWriter pw;

    public static void initReader() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

//        reader = new BufferedReader(new FileReader("test.in"));
//        tokenizer = new StringTokenizer("");
//        pw = new PrintWriter(new BufferedWriter(new FileWriter("My answer.out")));
    }

    public static boolean hasNext() {
        try {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (Exception e) {
            return false;
        }
        return true;
    }

    public static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    public static String nextLine() {
        try {
            return reader.readLine();
        } catch (Exception e) {
            return null;
        }
    }

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

    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static char nextChar() throws IOException {
        return next().charAt(0);
    }

}
