#include using namespace std; typedef pair pii; typedef long long ll; typedef vector vi; #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i=m;i<(n);i++) #define ALL(c) (c).begin(),(c).end() #define dump(x) cout << #x << " = " << (x) << endl constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); } template ostream& operator<<(ostream& os, const pair& p) { os<<"("< ostream& operator<<(ostream& os, const vector& v) { os<<"{"; rep(i, v.size()) { if (i) os<<","; os< class BIT { T bit[MN]; int n; public: BIT() { n = MN; memset(bit, 0, sizeof(bit)); } T sum(int i) { ++i; T s = 0; while (i > 0) { s += bit[i]; i -= i & -i; } return s; } void add(int i, T x) { ++i; while (i < n) { bit[i] += x; i += i & -i; } } }; int main() { int N, Q; cin >> N >> Q; vi a(N), df(N-1); rep(i, N) { cin >> a[i]; } BIT T; rep(i, N-1) { df[i] = (a[i+1] - a[i]); if (df[i] == 0) { T.add(i, 1); } } rep(i, Q) { int t, l, r; cin >> t >> l >> r; --l; --r; if (t == 1) { int x; cin >> x; if (l) { if (df[l-1] == 0) { T.add(l-1, -1); } df[l-1] += x; if (df[l-1] == 0) { T.add(l-1, 1); } } if (r < N-1) { if (df[r] == 0) { T.add(r, -1); } df[r] -= x; if (df[r] == 0) { T.add(r, 1); } } } else { int ans = T.sum(r-1) - T.sum(l-1); printf("%d\n", r - l + 1 - ans); } } return 0; }