#include #include using namespace std; using namespace atcoder; struct S { int mx, mn; vector vec; }; S op(S a, S b) { S res; res.mx = max(a.mx, b.mx); res.mn = min(a.mn, b.mn); 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, 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, {a}}); } while (q--) { int t, l, r; cin >> t >> l >> r; l--; cout << seg.prod(l, r).vec.size() << endl; } }