class SegmentTree: def __init__(self, N): self.N = 2**(N-1).bit_length() self.data = [0] * (2*self.N) def update(self, k, x): k += self.N-1 self.data[k] = x while k >= 0: k = (k - 1) // 2 self.data[k] = self.data[2*k+1] + self.data[2*k+2] def query(self, l, r): L = l + self.N R = r + self.N s = 0 while L < R: if R & 1: R -= 1 s += self.data[R-1] if L & 1: s += self.data[L-1] L += 1 L >>= 1; R >>= 1 return s N, Q = map(int,input().split()) A = list(map(int,input().split())) query = [list(map(int,input().split())) for _ in range(Q)] B = [A[i+1] - A[i] for i in range(N-1)] N = N-1 st = SegmentTree(N) for i, b in enumerate(B): st.update(i, b != 0) for line in query: if len(line) == 4: q, l, r, x = line l -= 1 r -= 1 if l != 0: B[l-1] += x st.update(l-1, B[l-1] != 0) if r != N: B[r] -= x st.update(r, B[r] != 0) elif len(line) == 3: q, l, r = line l -= 1 r -= 1 ans = st.query(l, r) + 1 print(ans)