import sys input = sys.stdin.readline class Fenwick_Tree: def __init__(self, n): self._n = n self.data = [0] * n def add(self, p, x): assert 0 <= p < self._n p += 1 while p <= self._n: self.data[p - 1] += x p += p & -p def sum(self, l, r): assert 0 <= l <= r <= self._n return self._sum(r) - self._sum(l) def _sum(self, r): s = 0 while r > 0: s += self.data[r - 1] r -= r & -r return s N, Q = map(int, input().split()) A = list(map(int, input().split())) inf = 10 ** 18 T = Fenwick_Tree(N + 3) Tans = Fenwick_Tree(N + 3) T.add(0, inf) T.add(1, -inf) T.add(N + 1, inf) T.add(N + 2, -inf) for i in range(N): T.add(i + 1, A[i]) T.add(i + 2, -A[i]) for i in range(N + 1): if T.sum(0, i + 1) != T.sum(0, i + 2): Tans.add(i, 1) for _ in range(Q): q = list(map(int, input().split())) if q[0] == 1: l, r, x = q[1:] Tans.add(l-1, -int(T.sum(0, l) != T.sum(0, l + 1))) Tans.add(r, -int(T.sum(0, r + 1) != T.sum(0, r + 2))) T.add(l, x) T.add(r+1, -x) Tans.add(l-1, int(T.sum(0, l) != T.sum(0, l + 1))) Tans.add(r, int(T.sum(0, r + 1) != T.sum(0, r + 2))) else: l, r = q[1:] print(Tans.sum(l, r) + 1)