#####segfunc###### def segfunc(x,y): return x + y def init(init_val): #set_val for i in range(len(init_val)): seg[i+num-1]=init_val[i] #built for i in range(num-2,-1,-1) : seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) def update(k,x): k += num-1 seg[k] = x while k: k = (k-1)//2 seg[k] = segfunc(seg[k*2+1],seg[k*2+2]) def query(p,q): if q<=p: return ide_ele p += num-1 q += num-2 res=ide_ele while q-p>1: if p&1 == 0: res = segfunc(res,seg[p]) if q&1 == 1: res = segfunc(res,seg[q]) q -= 1 p = p//2 q = (q-1)//2 if p == q: res = segfunc(res,seg[p]) else: res = segfunc(segfunc(res,seg[p]),seg[q]) return res n, q = map(int, input().split()) #####単位元###### ide_ele = 0 num =2**(n-1).bit_length() seg=[ide_ele]*(2*num - 1) #阪堺区間に注意 a = list(map(int, input().split())) b = [a[i+1] - a[i] for i in range(n-1)] c = [1 if b[i] != 0 else 0 for i in range(len(b))] init(c) for i in range(q): query_input = list(map(int, input().split())) if query_input[0] == 1: l, r, x = query_input[1:] l,r = l-2, r-1 if l != 0: b[l-1] += x if r != n-1: b[r] -= x if b[l-1] != 0: update(l,1) else: update(l,0) if b[r] != 0: update(r,1) else: update(r,0) else: l, r = query_input[1:] print(query(l-1,r-1)+1)