#include #include using namespace std; using namespace atcoder; struct S { int mx; vector vec; }; S op(S a, S b) { S res; res.mx = max(a.mx, b.mx); vector v = a.vec; for (int x : b.vec) { if (x > a.mx) { v.push_back(x); } } res.vec = v; return res; } S e() { return {0, {}}; } int main() { int n, q; cin >> n >> q; segtree seg(n); for (int i = 0; i < n; i++) { int a; cin >> a; seg.set(i, {a, {a}}); } while (q--) { int t, l, r; cin >> t >> l >> r; l--; cout << seg.prod(l, r).vec.size() << endl; } }