Alice's hair is growing by leaps and bounds. Maybe the cause of it is the excess of vitamins, or maybe it is some black magic...

To prevent this, Alice decided to go to the hairdresser. She wants for her hair length to be at most $l$ centimeters after haircut, where $l$ is her favorite number. Suppose, that the Alice's head is a straight line on which $n$ hairlines grow. Let's number them from $1$ to $n$. With one swing of the scissors the hairdresser can shorten all hairlines on any segment to the length $l$, given that all hairlines on that segment had length strictly greater than $l$. The hairdresser wants to complete his job as fast as possible, so he will make the least possible number of swings of scissors, since each swing of scissors takes one second.

Alice hasn't decided yet when she would go to the hairdresser, so she asked you to calculate how much time the haircut would take depending on the time she would go to the hairdresser. In particular, you need to process queries of two types:  $0$ — Alice asks how much time the haircut would take if she would go to the hairdresser now.  $1$ $p$ $d$ — $p$-th hairline grows by $d$ centimeters. 

Note, that in the request $0$ Alice is interested in hypothetical scenario of taking a haircut now, so no hairlines change their length.


-----Input-----

The first line contains three integers $n$, $m$ and $l$ ($1 \le n, m \le 100\,000$, $1 \le l \le 10^9$) — the number of hairlines, the number of requests and the favorite number of Alice.

The second line contains $n$ integers $a_i$ ($1 \le a_i \le 10^9$) — the initial lengths of all hairlines of Alice.

Each of the following $m$ lines contains a request in the format described in the statement.

The request description starts with an integer $t_i$. If $t_i = 0$, then you need to find the time the haircut would take. Otherwise, $t_i = 1$ and in this moment one hairline grows. The rest of the line than contains two more integers: $p_i$ and $d_i$ ($1 \le p_i \le n$, $1 \le d_i \le 10^9$) — the number of the hairline and the length it grows by.


-----Output-----

For each query of type $0$ print the time the haircut would take.


-----Example-----
Input
4 7 3
1 2 3 4
0
1 2 3
0
1 1 3
0
1 3 1
0

Output
1
2
2
1



-----Note-----

Consider the first example:  Initially lengths of hairlines are equal to $1, 2, 3, 4$ and only $4$-th hairline is longer $l=3$, and hairdresser can cut it in $1$ second.  Then Alice's second hairline grows, the lengths of hairlines are now equal to $1, 5, 3, 4$  Now haircut takes two seonds: two swings are required: for the $4$-th hairline and for the $2$-nd.  Then Alice's first hairline grows, the lengths of hairlines are now equal to $4, 5, 3, 4$  The haircut still takes two seconds: with one swing hairdresser can cut $4$-th hairline and with one more swing cut the segment from $1$-st to $2$-nd hairline.  Then Alice's third hairline grows, the lengths of hairlines are now equal to $4, 5, 4, 4$  Now haircut takes only one second: with one swing it is possible to cut the segment from $1$-st hairline to the $4$-th.

Difficulty: EASY
Tags: Spanning trees

Implementation

Starter code:

Solutions:
(n, q, l) = map(int, input().split())
a = [0] + list(map(int, input().split())) + [0]
t = 0
s = [False] * (n + 2)
for i in range(1, n + 1):
	if a[i] > l:
		if s[i - 1] == False:
			t += 1
		s[i] = True
for i in range(q):
	k = input()
	if k[0] == '0':
		print(t)
	else:
		(k, p, d) = map(int, k.split())
		a[p] += d
		if a[p] > l and s[p] == False:
			if s[p - 1] and s[p + 1]:
				t -= 1
			elif s[p - 1] == False and s[p + 1] == False:
				t += 1
			else:
				pass
			s[p] = True


gcd = lambda a, b: gcd(b, a % b) if b else a

def main():
	(n, m, l) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = [i > l for i in arr]
	total = 0
	for i in range(len(brr)):
		if brr[i] and (not i or not brr[i - 1]):
			total += 1
	for i in range(m):
		s = input()
		if s[0] == '0':
			print(total)
		else:
			(_, a, b) = map(int, s.split())
			a -= 1
			arr[a] += b
			if arr[a] > l and (not brr[a]):
				brr[a] = True
				if (a > 0 and brr[a - 1]) and (a < len(brr) - 1 and brr[a + 1]):
					total -= 1
				elif (a == 0 or (a > 0 and (not brr[a - 1]))) and (a == len(brr) - 1 or (a < len(brr) - 1 and (not brr[a + 1]))):
					total += 1
main()


class CodeforcesTask1055BSolution:

	def __init__(self):
		self.result = ''
		self.n_m_l = []
		self.hairline = []
		self.queries = []

	def read_input(self):
		self.n_m_l = [int(x) for x in input().split(' ')]
		self.hairline = [int(x) for x in input().split(' ')]
		for _ in range(self.n_m_l[1]):
			self.queries.append([int(y) for y in input().split(' ')])

	def process_task(self):
		res = []
		time = 0
		comp = [0] * self.n_m_l[0]
		add = [[1, x + 1, self.hairline[x]] for x in range(self.n_m_l[0])]
		self.queries = add + self.queries
		self.hairline = [0] * self.n_m_l[0]
		for q in self.queries:
			if not q[0]:
				res.append(time)
			else:
				if self.hairline[q[1] - 1] <= self.n_m_l[2] < self.hairline[q[1] - 1] + q[2]:
					comp[q[1] - 1] = 1
					if self.n_m_l[0] > 1:
						if 1 < q[1] < self.n_m_l[0]:
							if comp[q[1] - 2] and comp[q[1]]:
								time -= 1
							elif not comp[q[1] - 2] and (not comp[q[1]]):
								time += 1
						elif q[1] == 1:
							if not comp[1]:
								time += 1
						elif q[1] == self.n_m_l[0]:
							if not comp[-2]:
								time += 1
					else:
						time += 1
				self.hairline[q[1] - 1] += q[2]
		self.result = '\n'.join([str(x) for x in res])

	def get_result(self):
		return self.result
Solution = CodeforcesTask1055BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


from sys import stdin, stdout
(input, print) = (stdin.readline, stdout.write)

def main(input=input, print=print, map=map, int=int, float=float, range=range, sum=sum, str=str, list=list):
	(n, m, k) = map(int, input().split())
	a = [-float('inf')] + list(map(int, input().split())) + [-float('inf')]
	ans = sum((a[q] <= k < a[q + 1] for q in range(n + 1)))
	answer = []
	for _ in range(m):
		d = list(map(int, input().split()))
		if d[0] == 0:
			answer.append(str(ans))
		else:
			(q, x) = (d[1], d[2])
			if a[q - 1] > k and a[q + 1] > k and (a[q] + x > k >= a[q]):
				ans -= 1
			elif a[q - 1] <= k and a[q + 1] <= k and (a[q] + x > k >= a[q]):
				ans += 1
			a[q] += x
	print('\n'.join(answer))
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
v = [0] * n
cnt = 0
for i in range(n):
	if arr[i] > k:
		v[i] = 1
		if (i < n - 1 and v[i + 1] == 1) and (i > 0 and v[i - 1] == 1):
			cnt -= 1
		elif i < n - 1 and v[i + 1] == 1 or (i > 0 and v[i - 1] == 1):
			pass
		else:
			cnt += 1
for i in range(m):
	var = list(map(int, input().split()))
	if var == [0]:
		print(cnt)
	else:
		ha = int(var[1])
		le = int(var[2])
		arr[ha - 1] += le
		if arr[ha - 1] <= k or v[ha - 1] == 1:
			continue
		v[ha - 1] = 1
		if (ha < n and v[ha] == 1) and (ha > 1 and v[ha - 2] == 1):
			cnt -= 1
		elif ha < n and v[ha] == 1 or (ha > 1 and v[ha - 2] == 1):
			pass
		elif arr[ha - 1] > k:
			cnt += 1


class DisjointSets:

	def __init__(self, n):
		self.parent = [-1 for x in range(n + 1)]
		self.rank = [-1 for x in range(n + 1)]

	def makeSet(self, node):
		self.parent[node] = node
		self.rank[node] = 0

	def find(self, node):
		parent = self.parent
		if parent[node] != node:
			parent[node] = self.find(parent[node])
		return parent[node]

	def union(self, node, other):
		rank = self.rank
		parent = self.parent
		if rank[node] > rank[other]:
			parent[other] = node
		elif rank[other] > rank[node]:
			parent[node] = other
		else:
			parent[node] = other
			rank[other] += 1

def makeSetp(i):
	global ans, n
	if ds.parent[i] == -1:
		ds.makeSet(i)
		ans += 1
		if i <= n - 1 and ds.parent[i + 1] != -1:
			ds.union(i, i + 1)
			ans -= 1
		if i > 0 and ds.parent[i - 1] != -1:
			ds.union(i, i - 1)
			ans -= 1
ans = 0
(n, m, l) = map(int, input().split())
ds = DisjointSets(n)
seq = list(map(int, input().split()))
for i in range(len(seq)):
	if seq[i] > l:
		makeSetp(i)
for _ in range(m):
	x = input()
	if x == '0':
		print(ans)
	else:
		x = list(map(int, x.split()))
		i = x[1] - 1
		seq[i] += x[2]
		if seq[i] > l:
			makeSetp(i)


class Alice:

	def __init__(self, hair, l):
		self.head = []
		self.long_hairs = set()
		self.l = l
		self.roots = 0
		for (p, d) in enumerate(hair):
			self.grow_initial_hair(p, d)

	def grow_initial_hair(self, p, d):
		self.head.append(d)
		if self.l < d:
			if p - 1 not in self.long_hairs:
				self.roots += 1
			self.long_hairs.add(p)

	def grow_hair(self, p, d):
		hair_before = self.head[p]
		self.head[p] += d
		if hair_before <= self.l < self.head[p]:
			self.long_hairs.add(p)
			is_right_long = p + 1 in self.long_hairs
			is_left_long = p - 1 in self.long_hairs
			if not is_left_long and (not is_right_long):
				self.roots += 1
			elif is_left_long and is_right_long:
				self.roots -= 1

	def cut(self):
		return self.roots

def main():
	(n, m, l) = map(int, input().split())
	initial_hair = map(int, input().split())
	alice = Alice(initial_hair, l)
	for _ in range(m):
		request = input()
		if request == '0':
			print(alice.cut())
		else:
			(t, p, d) = map(int, request.split())
			alice.grow_hair(p - 1, d)
main()


from sys import stdin, stdout
(input, print) = (stdin.readline, stdout.write)

def main(input=input, print=print, map=map, int=int, range=range, set=set, str=str, list=list):
	(n, m, l) = map(int, input().split())
	a = list(map(int, input().split()))
	d = set()
	(f, x) = (False, 0)
	for q in range(n):
		if a[q] > l:
			if not f:
				f = True
				x += 1
			d.add(q)
		else:
			f = False
	answer = []
	for _ in range(m):
		s = list(map(int, input().split()))
		if s[0] == 0:
			answer.append(str(x))
		else:
			w = s[1]
			a[w - 1] += s[2]
			if a[w - 1] > l and w - 1 not in d:
				d.add(w - 1)
				if w - 2 in d and w in d:
					x -= 1
				elif w - 2 in d or w in d:
					pass
				else:
					x += 1
	print('\n'.join(answer))
main()


from sys import stdin, stdout
(input, print) = (stdin.readline, stdout.write)

def main(input=input, print=print, map=map, int=int, range=range, str=str, list=list):
	(n, m, l) = map(int, input().split())
	a = [-1] + list(map(int, input().split())) + [-1]
	x = sum((1 for q in range(n + 1) if a[q] > l >= a[q - 1]))
	answer = []
	for _ in range(m):
		s = list(map(int, input().split()))
		if s[0] == 0:
			answer.append(str(x))
		else:
			w = s[1]
			if a[w] + s[2] > l >= a[w]:
				x += (a[w - 1] <= l) + (a[w + 1] <= l) - 1
			a[w] += s[2]
	print('\n'.join(answer))
main()


(n, m, l) = map(int, input().split())
a = list(map(int, input().split()))
subs = [0] * (n + 2)
cnt = 0
flag = False
for i in range(n):
	if a[i] > l:
		if flag == False:
			cnt += 1
			flag = True
		subs[i + 1] = 1
	else:
		flag = False
for i in range(m):
	q = tuple(map(int, input().split()))
	op = q[0]
	if op == 1:
		(op, p, d) = q
		before = a[p - 1]
		a[p - 1] += d
		if before <= l < a[p - 1]:
			subs[p] = 1
			if subs[p - 1] and subs[p + 1]:
				cnt -= 1
			elif not (subs[p - 1] or subs[p + 1]):
				cnt += 1
	else:
		print(cnt)


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import *
from bisect import *
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, m, le) = tup()
ls = lint()
(c, ans) = (0, 0)
for i in range(n):
	if ls[i] > le:
		c += 1
	elif c:
		ans += 1
		c = 0
if c:
	ans += 1
for _ in range(m):
	l = lint()
	if l[0] == 0:
		print(ans)
	else:
		(p, d) = (l[1] - 1, l[2])
		if ls[p] <= le and ls[p] + d > le:
			ans += 1
			if p > 0 and ls[p - 1] > le:
				ans -= 1
			if p < n - 1 and ls[p + 1] > le:
				ans -= 1
		ls[p] += d
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


from sys import stdin, stdout

def main():
	(n, m, l) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	b = [0] * n
	for i in range(n):
		if a[i] > l:
			b[i] = 1
	ans = 0
	for i in range(n):
		if i == 0 and b[i] == 1:
			ans += 1
		elif i > 0 and b[i - 1] == 0 and (b[i] == 1):
			ans += 1
	for _ in range(m):
		inp = list(map(int, stdin.readline().split()))
		if inp[0] == 0:
			stdout.write('%d\n' % ans)
		else:
			i = inp[1] - 1
			v = inp[2]
			if a[i] > l:
				continue
			if a[i] + v > l:
				if i > 0 and i < n - 1:
					if b[i - 1] and b[i + 1]:
						ans -= 1
						a[i] += v
						b[i] = 1
					elif not b[i - 1] and (not b[i + 1]):
						ans += 1
						a[i] += v
						b[i] = 1
					else:
						a[i] += v
						b[i] = 1
				elif i == 0:
					if n == 1:
						ans += 1
						a[i] += v
						b[i] = 1
					elif b[i + 1] == 0:
						ans += 1
						a[i] += v
						b[i] = 1
					else:
						a[i] += v
						b[i] = 1
				elif i == n - 1:
					if b[i - 1] == 0:
						ans += 1
						a[i] += v
						b[i] = 1
					else:
						a[i] += v
						b[i] = 1
			else:
				a[i] += v
main()


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** 6 + 7
(n, m, l) = R()
a = [0] + L() + [0]
g = 1
ln = 0
grp = []
val = [0] * n
flg = False
for i in range(1, n + 2):
	if a[i] <= l and flg:
		g += 1
		flg = False
		ln += 1
	elif a[i] > l:
		flg = True
		val[i - 1] = g
for _ in range(m):
	v = L()
	if not v[0]:
		print(ln)
	else:
		ind = v[1]
		a[ind] += v[-1]
		if a[ind] > l and a[ind] - v[-1] <= l:
			if a[ind - 1] > l < a[ind + 1]:
				val[ind - 1] = val[ind - 2]
				p = val[ind]
				i = ind
				while i < n and val[i] == p:
					val[i] = val[ind - 1]
					i += 1
				ln -= 1
			elif a[ind - 1] > l:
				val[ind - 1] = val[i - 2]
			elif a[ind + 1] > l:
				val[ind - 1] = val[ind]
			else:
				val[ind - 1] = g
				g += 1
				ln += 1


(n, m, l) = map(int, input().split())
a = list(map(int, input().split()))
nexxt = {}
prevv = {}
nexxt[-1] = n
prevv[n] = -1
summ = 0
p = -1
l += 1
for k in range(n):
	if a[k] < l:
		p1 = p
		p = k
		nexxt[k] = n
		prevv[k] = p1
		nexxt[p1] = k
		if k - prevv[k] > 1:
			summ += 1
prevv[n] = p
if n - p > 1:
	summ += 1
for i in range(m):
	s = input()
	if s == '0':
		print(summ)
	else:
		(j, p, d) = map(int, s.split())
		if j != 1:
			continue
		if a[p - 1] < l:
			a[p - 1] += d
			if a[p - 1] >= l:
				k = p - 1
				left = prevv[k]
				right = nexxt[k]
				nexxt[left] = right
				prevv[right] = left
				if k - prevv[k] > 1:
					summ -= 1
				if nexxt[k] - k > 1:
					summ -= 1
				summ += 1


import sys

def rint():
	return map(int, sys.stdin.readline().split())
(n, m, l) = rint()
a = list(rint())
seg_cnt = 0
for i in range(1, n):
	if a[i - 1] > l and a[i] <= l:
		seg_cnt += 1
if a[n - 1] > l:
	seg_cnt += 1
for i in range(m):
	t = list(rint())
	if t[0] == 0:
		print(seg_cnt)
	else:
		p = t[1] - 1
		d = t[2]
		if a[p] + d > l and a[p] <= l:
			if p == 0:
				if a[(p + 1) % n] <= l:
					seg_cnt += 1
			elif p == n - 1:
				if a[p - 1] <= l:
					seg_cnt += 1
			elif a[p - 1] > l and a[(p + 1) % n] > l:
				seg_cnt -= 1
			elif a[p - 1] <= l and a[(p + 1) % n] <= l:
				seg_cnt += 1
		a[p] += d


(n, m, l) = list(map(int, input().split()))
a = list(map(int, input().split()))
r = []
for i in range(m):
	r.append(list(map(int, input().split())))
ans = 0
for i in range(n):
	if a[i] > l and (i == 0 or a[i - 1] <= l):
		ans += 1
for i in range(m):
	if r[i][0] == 0:
		print(ans)
		continue
	j = r[i][1] - 1
	k = r[i][2]
	if a[j] > l:
		continue
	a[j] += k
	if a[j] > l:
		if n == 1 and ans == 0:
			ans += 1
		elif j == 0 and n > 1 and (a[j + 1] <= l):
			ans += 1
		elif j == n - 1 and n > 1 and (a[j - 1] <= l):
			ans += 1
		elif j > 0 and j < n - 1 and (a[j - 1] <= l) and (a[j + 1] <= l):
			ans += 1
		elif j > 0 and j < n - 1 and (a[j - 1] > l) and (a[j + 1] > l):
			ans -= 1


(n, m, l) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
g = [a[k] > l for k in range(n)]
res = []
curr_res = sum([g[0]] + [v for (j, v) in enumerate(g[1:]) if v != g[j]])
for i in range(m):
	req = list(map(int, input().split(' ')))
	if req[0]:
		(req, p, q) = req
		new_len = a[p - 1] + q
		new_g = new_len > l
		if n == 1:
			curr_res = 1 if new_g else 0
		elif p == 1 or p == n:
			if p == 1 and (not g[0]) and (not g[1]) and new_g:
				curr_res += 1
			elif p == n and (not g[n - 1]) and (not g[n - 2]) and new_g:
				curr_res += 1
		elif not g[p - 1] and (not g[p - 2]) and (not g[p]) and new_g:
			curr_res += 1
		elif not g[p - 1] and g[p - 2] and g[p] and new_g:
			curr_res -= 1
		a[p - 1] = new_len
		g[p - 1] = new_g
	else:
		res.append(curr_res)
for i in range(len(res)):
	print(res[i])


def inint():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def main():
	(n, m, l) = inlist()
	aa = inlist()
	chg = 0
	ch = 0
	a = [[i, 0] for i in aa]
	for i in range(n):
		if aa[i] > l:
			if ch == 0:
				ch += 1
				chg += 1
				a[i][1] = chg
			else:
				ch += 1
				a[i][1] = chg
		elif ch != 0:
			ch = 0
	sol = list()
	if n > 1:
		for z in range(m):
			qu = input()
			if qu == '0':
				sol.append(chg)
			else:
				(zz, p, d) = list(map(int, qu.split()))
				p -= 1
				a[p][0] += d
				if a[p][1] == 0 and a[p][0] > l:
					if p > 0 and p < n - 1:
						if a[p - 1][1] == 0 and a[p + 1][1] == 0:
							chg += 1
							a[p][1] = chg
						elif a[p - 1][1] == 0 and a[p + 1][1] > 0:
							a[p][1] = a[p + 1][1]
						elif a[p - 1][1] > 0 and a[p + 1][1] == 0:
							a[p][1] = a[p - 1][1]
						else:
							a[p][1] = a[p - 1][1]
							chg -= 1
					elif p == 0:
						if a[p + 1][1] == 0:
							chg += 1
							a[p][1] = chg
						else:
							a[p][1] = a[p + 1][1]
					elif p == n - 1:
						if a[p - 1][1] == 0:
							chg += 1
							a[p][1] = chg
						else:
							a[p][1] = a[p - 1][1]
	else:
		for z in range(m):
			qu = input()
			if qu == '0':
				sol.append(chg)
			else:
				(zz, p, d) = list(map(int, qu.split()))
				p -= 1
				a[p][0] += d
				if a[p][0] > d:
					chg = 1
	print(*sol, sep='\n')
main()


(n, m, l) = map(int, input().split())
arr = list(map(int, input().split()))
segments = 0
flag = 0
for i in range(n):
	if arr[i] > l:
		if flag == 0:
			flag = 1
			segments += 1
	else:
		flag = 0
ans = []
for i in range(m):
	arr1 = list(map(int, input().split()))
	if len(arr1) == 1:
		ans.append(segments)
	else:
		arr1[1] -= 1
		temp = arr[arr1[1]]
		if arr1[1] == 0:
			arr[0] += arr1[2]
			if n > 1:
				if arr[0] > l and arr[1] <= l and (temp <= l):
					segments += 1
			elif arr[0] > l and temp <= l:
				segments += 1
		elif arr1[1] == n - 1:
			arr[n - 1] += arr1[2]
			if n > 1:
				if arr[n - 1] > l and arr[n - 2] <= l and (temp <= l):
					segments += 1
			elif arr[0] > l and temp <= l:
				segments += 1
		else:
			arr[arr1[1]] += arr1[2]
			if arr[arr1[1]] > l and arr[arr1[1] - 1] <= l and (arr[arr1[1] + 1] <= l) and (temp <= l):
				segments += 1
			elif arr[arr1[1]] > l and arr[arr1[1] - 1] > l and (arr[arr1[1] + 1] > l) and (temp <= l):
				segments -= 1
print(*ans)


from sys import stdin, stdout

def main(input=stdin.readlines, print=stdout.write, map=map, int=int, str=str):
	(lines, answer) = (input(), [])
	(n, m, l) = map(int, lines[0].split())
	a = [-1] + list(map(int, lines[1].split())) + [-1]
	x = sum((1 for q in range(n + 1) if a[q] > l >= a[q - 1]))
	for q1 in range(2, m + 2):
		if lines[q1] == '0\n':
			answer.append(str(x))
		else:
			(w2, w, w1) = map(int, lines[q1].split())
			if a[w] + w1 > l >= a[w]:
				x += (a[w - 1] <= l) + (a[w + 1] <= l) - 1
			a[w] += w1
	print('\n'.join(answer))
main()


from sys import stdin, stdout
(a, b, c) = map(int, stdin.readline().split())
z = list(map(int, stdin.readline().split()))
ans = ''
f = 0
i = 0
while i < a:
	if z[i] > c:
		i += 1
		f += 1
		while i < a and z[i] > c:
			i += 1
	else:
		i += 1
for _ in ' ' * b:
	x = list(map(int, stdin.readline().split()))
	if x[0] == 0:
		ans += str(f) + ' '
	else:
		x[1] -= 1
		if z[x[1]] <= c:
			if z[x[1]] + x[2] <= c:
				z[x[1]] += x[2]
			else:
				z[x[1]] += x[2]
				if x[1] == 0:
					if a == 1:
						f = 1
					elif z[1] <= c:
						f += 1
				elif x[1] == a - 1:
					if z[x[1] - 1] <= c:
						f += 1
				elif z[x[1] - 1] > c and z[x[1] + 1] > c:
					f -= 1
				elif z[x[1] - 1] <= c and z[x[1] + 1] <= c:
					f += 1
stdout.write(ans)


(n, m, l) = list(map(int, input().split()))
a = list(map(int, input().split()))
c = 0
if a[0] > l:
	c += 1
	a[0] = 0
for i in range(1, n):
	if a[i] > l:
		a[i] = 0
		if a[i - 1] != 0:
			c += 1
for i in range(m):
	s = input()
	if s[0] == '0':
		print(c)
	else:
		(_, x, y) = list(map(int, s.split()))
		if a[x - 1] <= l and a[x - 1] != 0:
			if a[x - 1] + y > l:
				if x != 1 and x != n and (a[x - 2] != 0) and (a[x] != 0):
					c += 1
					a[x - 1] = 0
				elif x == 1 and n != 1 and (a[x] != 0):
					a[x - 1] = 0
					c += 1
				elif x == n and n != 1 and (a[x - 2] != 0):
					a[x - 1] = 0
					c += 1
				elif x != 1 and x != n and (a[x - 2] == 0) and (a[x] == 0):
					c -= 1
					a[x - 1] = 0
				elif n == 1:
					if c == 0:
						c = 1
				else:
					a[x - 1] = 0
			else:
				a[x - 1] += y


import sys
input = sys.stdin.readline
print = sys.stdout.write
(N, M, L) = map(int, input().split())
A = [int(i) for i in input().split()]
components = 0
run = False
for i in A:
	if not run and i > L:
		run = True
		components += 1
	elif i <= L:
		run = False
for i in range(M):
	line = [int(j) for j in input().split()]
	if line[0] == 0:
		print(str(components) + '\n')
	else:
		q = line[1]
		r = line[2]
		A[q - 1] += r
		if A[q - 1] - r <= L and A[q - 1] > L:
			if q > 1 and q < N:
				if A[q - 2] <= L and A[q] <= L:
					components += 1
				elif A[q - 2] > L and A[q] > L:
					components -= 1
			elif q == 1 and N == 1 or (q == 1 and N > 1 and (A[q] <= L)) or (q == N and A[q - 2] <= L):
				components += 1


def CuttingTime(hairline_len, l, time, p, d):
	n = len(hairline_len.keys())
	if hairline_len[p] <= l:
		hairline_len[p] += d
		if p == 1:
			if n > 1:
				if hairline_len[p + 1] <= l and hairline_len[p] > l:
					time += 1
			elif hairline_len[p] - d <= l:
				time += 1
		elif 1 < p < n:
			if hairline_len[p] > l:
				if hairline_len[p - 1] <= l and hairline_len[p + 1] <= l:
					time += 1
				elif hairline_len[p - 1] > l and hairline_len[p + 1] > l and (time > 1):
					time -= 1
		elif hairline_len[p - 1] <= l and hairline_len[p] > l:
			time += 1
	return time

def InitialTIme(hairline_len, l):
	time = 0
	count = 0
	for i in hairline_len:
		if hairline_len[i] > l:
			count += 1
		else:
			if count > 0:
				time += 1
			count = 0
	if count > 0:
		time += 1
	return time

def AliceHairDresser():
	inputs = list(map(int, input().split()))
	n = inputs[0]
	m = inputs[1]
	l = inputs[2]
	lengths = list(map(int, input().split()))
	hairline_len = {}
	for i in range(1, n + 1):
		hairline_len[i] = lengths[i - 1]
	time = InitialTIme(hairline_len, l)
	for i in range(m):
		query = input()
		if len(query) == 1:
			print(time)
		else:
			inputs1 = list(map(int, query.split()))
			p = inputs1[1]
			d = inputs1[2]
			if hairline_len[p] <= l:
				time = CuttingTime(hairline_len, l, time, p, d)
AliceHairDresser()


from sys import stdin

def ip():
	return stdin.readline().strip().split()
(n, m, l) = map(int, ip())
a = [int(x) for x in ip()]
i = j = 0
c = 0
while i < n:
	if a[i] > l:
		c += 1
		j = i + 1
		while j < n and a[j] > l:
			j += 1
		i = j
	else:
		i += 1
for i in range(m):
	s = ip()
	if len(s) == 1:
		print(c)
	else:
		(one, p, d) = map(int, s)
		p -= 1
		if a[p] <= l and a[p] + d > l:
			if (p - 1 >= 0 and a[p - 1] > l) and (p + 1 < n and a[p + 1] > l):
				c -= 1
			elif p - 1 >= 0 and a[p - 1] > l or (p + 1 < n and a[p + 1] > l):
				pass
			else:
				c += 1
		a[p] += d


(n, m, l) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
anss = []
ans = 0
on = False
for i in range(n):
	if a[i] > l and (not on):
		ans += 1
		on = True
	elif a[i] <= l and on:
		on = False
for i in range(m):
	r = [int(s) for s in input().split()]
	if r[0] == 0:
		anss.append(ans)
	else:
		(p, d) = (r[1] - 1, r[2])
		if a[p] <= l and a[p] + d > l:
			add = 1
			if p > 0 and a[p - 1] > l:
				add -= 1
			if p < n - 1 and a[p + 1] > l:
				add -= 1
			ans += add
		a[p] += d
print(*anss, sep='\n')


(n, m, l) = map(int, input().split())
res = []
tim = 0
a = list(map(int, input().split()))
i = 0
while i < n:
	while i < n and a[i] <= l:
		i += 1
	if i == n:
		break
	tim += 1
	while i < n and a[i] > l:
		i += 1
for i in range(m):
	s = input()
	if s == '0':
		res.append(str(tim))
		continue
	(w, p, d) = map(int, s.split())
	p -= 1
	if a[p] > l:
		continue
	a[p] += d
	if a[p] <= l:
		continue
	if p > 0 and a[p - 1] > l and (p < n - 1) and (a[p + 1] > l):
		tim -= 1
	elif p > 0 and a[p - 1] > l or (p < n - 1 and a[p + 1] > l):
		continue
	else:
		tim += 1
s = '\n'.join(res)
print(s)


(n, m, l) = map(int, input().split())
l += 1
hair = [1] * (n + 1)
other_end = [1] * (n + 1)
i = 1
j = 1
big = 1
res = 1
for a in map(int, input().split()):
	hair[i] = a
	if a >= l:
		if big == 1:
			j = i
			big = 2
	elif big == 2:
		k = i - 1
		other_end[k] = j
		other_end[j] = k
		res += 1
		big = 1
	i += 1
if big == 2:
	other_end[n] = j
	other_end[j] = n
	res += 1
for _ in range(m):
	t = input()
	if t == '0':
		if res == 1:
			print('0')
		else:
			print(res - 1)
	else:
		(t1, p, d) = map(int, t.split())
		old = hair[p]
		hair[p] += d
		if hair[p] >= l > old:
			if p == 1 or hair[p - 1] < l:
				case_id = 1
			else:
				case_id = 2
			if p != n and hair[p + 1] >= l:
				case_id += 2
			if case_id == 1:
				other_end[p] = p
				res += 1
			elif case_id == 2:
				other_end[p] = other_end[p - 1]
				other_end[other_end[p]] = p
			elif case_id == 3:
				other_end[p] = other_end[p + 1]
				other_end[other_end[p]] = p
			else:
				left_end = other_end[p - 1]
				right_end = other_end[p + 1]
				other_end[left_end] = right_end
				other_end[right_end] = left_end
				res -= 1


def main():
	(n, m, l) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	d = [i > l for i in a]
	ans = 0
	for i in range(1, n):
		if d[i - 1] and (not d[i]):
			ans += 1
	if d[-1]:
		ans += 1
	for _ in range(m):
		r = [int(i) for i in input().split()]
		if r[0] == 0:
			print(ans)
		else:
			a[r[1] - 1] += r[2]
			if a[r[1] - 1] > l:
				if not d[r[1] - 1]:
					d[r[1] - 1] = True
					if r[1] - 1 == 0:
						prev = 0
					else:
						prev = d[r[1] - 2]
					if r[1] - 1 == n - 1:
						next = 0
					else:
						next = d[r[1]]
					if prev and next:
						ans -= 1
					if not (prev or next):
						ans += 1
main()


def go():
	(n, m, l) = [int(i) for i in input().split(' ')]
	a = [-1] + [int(i) for i in input().split(' ')] + [-1]
	o = ''
	c = 0
	for i in range(1, n + 1):
		if a[i] > l:
			if a[i - 1] <= l:
				c += 1
	for i in range(m):
		x = [int(j) for j in input().split(' ')]
		if x[0] == 0:
			o += str(c) + '\n'
		else:
			if a[x[1]] > l:
				continue
			a[x[1]] += x[2]
			if a[x[1]] > l:
				if a[x[1] - 1] > l and a[x[1] + 1] > l:
					c -= 1
				elif a[x[1] - 1] <= l and a[x[1] + 1] <= l:
					c += 1
	return o
print(go())


import sys
(_, m, l) = map(int, sys.stdin.readline().split())
A = [*map(int, sys.stdin.readline().split())]
count = 0
for (i, a) in enumerate(A):
	if a > l and (i == 0 or A[i - 1] <= l):
		count += 1
for _ in range(m):
	(t, *rest) = map(int, sys.stdin.readline().split())
	if t == 0:
		print(count)
	else:
		(p, d) = rest
		p -= 1
		if A[p] <= l and A[p] + d > l:
			(left, right) = (False, False)
			if p > 0 and A[p - 1] > l:
				left = True
			if p + 1 < len(A) and A[p + 1] > l:
				right = True
			if left and right:
				count -= 1
			elif not left and (not right):
				count += 1
		A[p] += d


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	(n, m, l) = ain()
	x = ain()
	p = [0] * n
	for i in range(n):
		if x[i] > l:
			p[i] = 1
	count = 0
	j = 0
	for i in range(n):
		if p[i] == 1:
			j = 1
		elif j == 1:
			count += 1
			j = 0
	if j == 1:
		count += 1
	for _ in range(m):
		q = ain()
		if q[0] == 0:
			print(count)
		else:
			x[q[1] - 1] += q[2]
			if x[q[1] - 1] > l and p[q[1] - 1] == 0:
				p[q[1] - 1] = 1
				if q[1] == 1:
					if n == 1:
						count += 1
					if n != 1 and p[q[1]] != 1:
						count += 1
				elif q[1] == n:
					if n != 1 and p[q[1] - 2] != 1:
						count += 1
				elif p[q[1] - 2] != 1 and p[q[1]] != 1:
					count += 1
				elif p[q[1] - 2] == 1 and p[q[1]] == 1:
					count -= 1
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
(n, m, l) = map(int, input().split())
d = list(map(int, input().split()))
c = 0
i = 0
f = 0
while i < n:
	if d[i] > l and f == 0:
		f = 1
		c += 1
	if d[i] <= l:
		f = 0
	i += 1
for i in range(m):
	k = list(map(int, input().split()))
	if k[0] == 0:
		print(c)
	else:
		(p, h) = (k[1] - 1, k[2])
		if d[p] <= l and d[p] + h > l:
			c += 1
			if p > 0 and d[p - 1] > l:
				c -= 1
			if p < n - 1 and d[p + 1] > l:
				c -= 1
		d[p] += h


import sys
input = sys.stdin.readline

def main():
	(n, m, l) = map(int, input().split())
	a = list(map(int, input().split()))
	d = {}
	used = set()
	current = 0
	for i in range(n):
		if a[i] > l:
			if i in used:
				continue
			elif i - 1 not in used and i + 1 not in used:
				current += 1
			elif i - 1 in used and i + 1 in used and (s[1] - 1 not in used):
				current -= 1
			used.add(i)
		d[i] = a[i]
	for i in range(m):
		s = list(map(int, input().split()))
		if s[0] == 0:
			print(current)
		elif s[0] == 1:
			d[s[1] - 1] += s[2]
			if d[s[1] - 1] > l:
				if s[1] - 1 in used:
					continue
				elif s[1] - 2 not in used and s[1] not in used:
					current += 1
				elif s[1] - 2 in used and s[1] in used and s[1] - 1:
					current -= 1
				used.add(s[1] - 1)
main()


(n, q, k) = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
count = 0

def verify(x):
	if x < 0 or x >= n:
		return False
	return a[x] > k
for i in range(n):
	if verify(i):
		count += 1
		if verify(i - 1):
			count -= 1

def cut(i):
	if not verify(i):
		return 0
	result = 1
	if verify(i - 1):
		result -= 1
	if verify(i + 1):
		result -= 1
	return result
for i in range(q):
	line = input()
	if line == '0':
		print(count)
	else:
		(_, x, y) = list(map(int, line.split(' ')))
		x -= 1
		if not verify(x):
			a[x] += y
			count += cut(x)
		else:
			a[x] += y


from bisect import bisect_right
from itertools import groupby, count, islice
from typing import List, NamedTuple, Iterator

class CutRange(NamedTuple):
	from_: int
	to: int

class HairCutter:

	def __init__(self, hair_lengths: List[int], max_hair_length: int):
		self._hair_lengths = hair_lengths
		self._max_hair_length = max_hair_length
		self._cut_ranges = self._get_cut_ranges()

	def increase_hair(self, hair_index: int, hair_increasing_length: int):
		old_length = self._hair_lengths[hair_index]
		new_length = self._hair_lengths[hair_index] = old_length + hair_increasing_length
		if old_length <= self._max_hair_length < new_length:
			self._update_cut_ranges(hair_index)

	@property
	def cut_time(self):
		return len(self._cut_ranges)

	def _get_cut_ranges(self) -> List[CutRange]:
		cut_ranges = []
		for (is_for_cut, cut_range) in groupby(range(len(self._hair_lengths)), lambda hair_length_index: self._hair_lengths[hair_length_index] > self._max_hair_length):
			if not is_for_cut:
				continue
			range_start = range_end = next(cut_range)
			for range_end in cut_range:
				pass
			cut_ranges.append(CutRange(range_start, range_end))
		return cut_ranges

	def _update_cut_ranges(self, hair_index: int):
		right_old_range_index = bisect_right(self._cut_ranges, CutRange(hair_index, hair_index))
		left_old_range_index = right_old_range_index - 1
		have_to_join_with_left = left_old_range_index >= 0 and self._cut_ranges[left_old_range_index].to == hair_index - 1
		have_to_join_with_right = len(self._cut_ranges) > right_old_range_index and self._cut_ranges[right_old_range_index].from_ == hair_index + 1
		if have_to_join_with_left and have_to_join_with_right:
			self._cut_ranges[left_old_range_index:right_old_range_index + 1] = [CutRange(self._cut_ranges[left_old_range_index].from_, self._cut_ranges[right_old_range_index].to)]
		elif have_to_join_with_left:
			self._cut_ranges[left_old_range_index] = CutRange(self._cut_ranges[left_old_range_index].from_, self._cut_ranges[left_old_range_index].to + 1)
		elif have_to_join_with_right:
			self._cut_ranges[right_old_range_index] = CutRange(self._cut_ranges[right_old_range_index].from_ - 1, self._cut_ranges[right_old_range_index].to)
		else:
			self._cut_ranges.insert(right_old_range_index, CutRange(hair_index, hair_index))

def main():
	input_data_iter = (map(int, input().split()) for _ in count())
	output_data_rows = []
	(_, commands_count, max_hair_length) = next(input_data_iter)
	hair_lengths = list(next(input_data_iter))
	hair_cutter = HairCutter(hair_lengths, max_hair_length)
	for (command, *arguments) in islice(input_data_iter, commands_count):
		if command == 0:
			output_data_rows.append(str(hair_cutter.cut_time))
		elif command == 1:
			hair_cutter.increase_hair(arguments[0] - 1, arguments[1])
	print('\n'.join(output_data_rows))
main()


from sys import stdin
(a, b, c) = map(int, stdin.readline().split())
z = list(map(int, stdin.readline().split()))
f = 0
i = 0
while i < a:
	if z[i] > c:
		i += 1
		f += 1
		while i < a and z[i] > c:
			i += 1
	else:
		i += 1
for _ in ' ' * b:
	x = list(map(int, stdin.readline().split()))
	if x[0] == 0:
		print(f)
	else:
		x[1] -= 1
		if z[x[1]] <= c:
			if z[x[1]] + x[2] <= c:
				z[x[1]] += x[2]
			else:
				z[x[1]] += x[2]
				if x[1] == 0:
					if a == 1:
						f = 1
					elif z[1] <= c:
						f += 1
				elif x[1] == a - 1:
					if z[x[1] - 1] <= c:
						f += 1
				elif z[x[1] - 1] > c and z[x[1] + 1] > c:
					f -= 1
				elif z[x[1] - 1] <= c and z[x[1] + 1] <= c:
					f += 1


(n, m, l) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

def time_to_cut():
	nonlocal a
	t = 0
	pr = 0
	for i in range(n):
		if a[i] <= l:
			pr = 0
		elif pr == 0:
			t += 1
			pr = 1
	return t

def update_time(p, d):
	nonlocal a
	nonlocal T
	p -= 1
	pos = 0 if a[p] <= l else 1
	a[p] += d
	pns = 0 if a[p] <= l else 1
	sa = bool(pns - pos)
	if not sa:
		pass
	elif n == 1:
		T += 1
	elif p == 0:
		if a[p + 1] <= l:
			T += 1
	elif p == n - 1:
		if a[p - 1] <= l:
			T += 1
	elif a[p + 1] <= l and a[p - 1] <= l:
		T += 1
	elif a[p + 1] > l and a[p - 1] > l:
		T -= 1
	return
T = time_to_cut()
for i in range(m):
	r = [int(x) for x in input().split()]
	if len(r) == 1:
		print(T)
	else:
		update_time(r[1], r[2])


import sys

def main():
	lines = sys.stdin.readlines()
	(n, m, l) = map(int, lines[0].split())
	a = [-1]
	a += map(int, lines[1].split())
	a.append(-1)
	n += 2
	time = sum((1 for i in range(1, n - 1) if a[i] > l and a[i - 1] <= l))
	res = []
	for i in range(2, m + 2):
		if lines[i] == '0\n':
			res.append(str(time))
		else:
			(_, p, d) = map(int, lines[i].split())
			if a[p] <= l and a[p] + d > l:
				cond = (a[p - 1] <= l) + (a[p + 1] <= l)
				time += cond == 2
				time -= cond == 0
			a[p] += d
	print('\n'.join(res))
main()


I = lambda : list(map(int, input().split()))
(n, m, l) = I()
arr = [-1] + I() + [-1]
cnt = 0
for i in range(1, n + 1):
	if arr[i] > l:
		cnt += arr[i - 1] <= l
while m:
	a = I()
	if a[0]:
		i = a[1]
		if arr[i] <= l and arr[i] + a[2] > l:
			cnt += 1 - (arr[i - 1] > l) - (arr[i + 1] > l)
		arr[i] += a[2]
	else:
		print(cnt)
	m -= 1


def main():
	(n, m, l) = [int(c) for c in input().split()]
	a = [-1]
	a += [int(c) for c in input().split()]
	a.append(-1)
	n += 2
	time = sum((1 for i in range(1, n - 1) if a[i] > l and a[i - 1] <= l))
	res = []
	for i in range(m):
		line = input()
		if line == '0':
			res.append(str(time))
		else:
			(_, p, d) = [int(c) for c in line.split()]
			if a[p] <= l and a[p] + d > l:
				cond = (a[p - 1] <= l) + (a[p + 1] <= l)
				time += cond == 2
				time -= cond == 0
			a[p] += d
	print('\n'.join(res))
main()


def grow_hair(k, hairs, length, hair_index, add_to_hair):
	old_hair_length = hairs[hair_index]
	hairs[hair_index] = hairs[hair_index] + add_to_hair
	if old_hair_length <= length < hairs[hair_index]:
		if 0 < hair_index < len(hairs) - 1 and hairs[hair_index - 1] > length and (hairs[hair_index + 1] > length):
			k -= 1
		elif (hair_index == 0 or hairs[hair_index - 1] <= length) and (len(hairs) - 1 == hair_index or hairs[hair_index + 1] <= length):
			k += 1
	return (k, hairs)

def count_k(hairs, l):
	k = 0
	for i in range(len(hairs)):
		if i == 0:
			if hairs[i] > l:
				k += 1
		elif hairs[i] > l:
			if hairs[i - 1] <= l:
				k += 1
	return k

def count_barber_work():
	(n, m, l) = map(int, input().split())
	hairs = list(map(int, input().split()))
	k = count_k(hairs, l)
	for _ in range(m):
		i = input()
		if i == '0':
			print(k)
		else:
			(_, hair_index, add_to_hair) = map(int, i.split())
			(k, hairs) = grow_hair(k, hairs, l, hair_index - 1, add_to_hair)
count_barber_work()


(n, m, l) = list(map(int, input().split()))
a = list(map(int, input().split()))
time = 0 if a[0] <= l else 1
for i in range(1, n):
	if a[i] > l and a[i - 1] <= l:
		time += 1
for i in range(m):
	line = input()
	if line == '0':
		print(time)
	else:
		(_, p, d) = list(map(int, line.split()))
		p -= 1
		if a[p] <= l and a[p] + d > l:
			is_left_short = p == 0 or a[p - 1] <= l
			is_right_short = p == n - 1 or a[p + 1] <= l
			cond = is_left_short + is_right_short
			if cond == 2:
				time += 1
			elif cond == 0:
				time -= 1
		a[p] += d


from bisect import bisect_right as br
from bisect import bisect_left as bl
import sys
MAX = sys.maxsize
MAXN = 10 ** 6 + 10

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()

def ans(a, l, n):
	f = 0
	cnt = 0
	for i in range(n):
		if a[i] > l:
			if not f:
				cnt += 1
				f = 1
		else:
			f = 0
	return cnt
(n, m, l) = numIN()
a = list(numIN())
cnt = ans(a, l, n)
fl = [0] * (n + 1)
for i in range(n):
	if a[i] > l:
		fl[i] = 1
for _ in range(m):
	x = list(numIN())
	if len(x) == 1:
		print(cnt)
	else:
		p = x[1] - 1
		d = x[2]
		a[p] += d
		if a[p] > l:
			if not fl[p]:
				if p == 0:
					if not fl[p + 1]:
						cnt += 1
				elif p == n - 1:
					if not fl[p - 1]:
						cnt += 1
				elif fl[p + 1] and fl[p - 1]:
					cnt -= 1
				elif not (fl[p + 1] or fl[p - 1]):
					cnt += 1
			fl[p] = 1


def main():
	(n, m, l) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [1 if a[i] > l else 0 for i in range(n)]
	blocks = 0
	ins = False
	for guy in b:
		if guy == 1:
			if not ins:
				ins = True
				blocks += 1
		elif ins:
			ins = False
	for i in range(m):
		c = input()
		if c[0] == '0':
			print(blocks)
		else:
			c = c.split()
			(d, e) = (int(c[1]), int(c[2]))
			f = b[d - 1]
			if f == 0:
				a[d - 1] += e
				if a[d - 1] > l:
					b[d - 1] = 1
					if d == 1:
						if len(b) == 1 or b[1] == 0:
							blocks += 1
					elif d == n:
						if b[-2] == 0:
							blocks += 1
					else:
						blocks += 1 - [b[d - 2], b[d]].count(1)
main()


(n, m, l) = [int(c) for c in input().split()]
a = [-1]
a += [int(c) for c in input().split()]
a.append(-1)
n += 2
time = sum((1 for i in range(1, n - 1) if a[i] > l and a[i - 1] <= l))
for i in range(m):
	line = input()
	if line == '0':
		print(time)
	else:
		(_, p, d) = [int(c) for c in line.split()]
		if a[p] <= l and a[p] + d > l:
			cond = (a[p - 1] <= l) + (a[p + 1] <= l)
			time += cond == 2
			time -= cond == 0
		a[p] += d


(n, m, l) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in a:
	if i > l:
		b.append(1)
	else:
		b.append(0)
ans = 0
i = 0
while i < n:
	if b[i]:
		ans += 1
		while i < n and b[i]:
			i += 1
	i += 1
for i in range(m):
	s = input()
	if s[0] == '0':
		print(ans)
	else:
		(t, p, d) = map(int, s.split())
		if a[p - 1] <= l:
			a[p - 1] += d
			if a[p - 1] > l:
				b[p - 1] = 1
				if p - 2 >= 0 and b[p - 2] and (p <= n - 1) and b[p]:
					ans -= 1
				elif p - 2 >= 0 and b[p - 2] or (p <= n - 1 and b[p]):
					ans += 0
				else:
					ans += 1


import sys
input1 = sys.stdin.readline
(n, m, l) = (int(x) for x in input1().split())
a = [int(x) for x in input1().split()]
cuts = 0
i = 0
while i < n:
	while i < n and a[i] < l:
		i += 1
	if i < n and a[i] > l:
		cuts += 1
	while i < n and a[i] > l:
		i += 1
	i += 1
for i in range(m):
	s = [int(x) for x in input1().split()]
	if s[0] == 0:
		print(cuts)
	else:
		p = s[1] - 1
		d = s[2]
		if a[p] <= l and (p == 0 or a[p - 1] <= l) and (p == n - 1 or a[p + 1] <= l) and (a[p] + d > l):
			cuts += 1
		elif a[p] <= l and p != 0 and (a[p - 1] > l) and (p != n - 1) and (a[p + 1] > l) and (a[p] + d > l):
			cuts -= 1
		a[p] += d


def prog():
	from sys import stdin
	(n, m, l) = map(int, stdin.readline().split())
	mas = list(map(int, stdin.readline().split()))
	di = {-1: -1, n: -1}
	(a, res) = (0, 0)
	for i in range(n):
		di[i] = mas[i]
		if mas[i] > l:
			if a == 0:
				res += 1
				a = 1
		else:
			a = 0
	for i in range(m):
		q = stdin.readline().split()
		if q[0] == '1':
			(e, r) = (int(q[1]), int(q[2]))
			e -= 1
			x = di[e]
			di[e] += r
			if di[e] > l and x <= l:
				if di[e - 1] > l and di[e + 1] > l:
					res -= 1
				if di[e - 1] <= l and di[e + 1] <= l:
					res += 1
		else:
			print(res)
prog()


(n, m, g) = list(map(int, input().split()))
l = [0] + list(map(int, input().split())) + [0]
ans = 0
bit = [0] + [0] * n + [0]
output = []
for i in range(1, n + 1):
	if l[i] > g:
		bit[i] = 1
		if bit[i - 1] == 0 and bit[i + 1] == 0:
			ans += 1
		elif bit[i - 1] == 1 and bit[i + 1] == 1:
			ans -= 1
for i in range(m):
	a = list(map(int, input().split()))
	if a[0] == 0:
		output.append(ans)
		continue
	else:
		l[a[1]] += a[2]
	if l[a[1]] > g:
		if bit[a[1]] == 0:
			bit[a[1]] = 1
			if bit[a[1] - 1] == 0 and bit[a[1] + 1] == 0:
				ans += 1
			elif bit[a[1] - 1] == 1 and bit[a[1] + 1] == 1:
				ans -= 1
print('\n'.join(map(str, output)))


from sys import *
input = lambda : stdin.readline().strip()
(n, m, l) = map(int, input().split())
hair = list(map(int, input().split()))
yon = []
ans = 0
p = False
for i in hair:
	yon.append(i > l)
	if not p and i > l:
		ans += 1
	p = i > l
for _ in range(m):
	req = input()
	if req == '0':
		print(ans)
	else:
		(_, i, v) = map(int, req.split())
		i -= 1
		if hair[i] <= l and hair[i] + v > l:
			yon[i] = True
			if (i and yon[i - 1]) and (i < n - 1 and yon[i + 1]):
				ans -= 1
			elif not (i and yon[i - 1] or (i < n - 1 and yon[i + 1])):
				ans += 1
		hair[i] += v


import math
import collections
import bisect
import heapq
import time
import itertools
import sys
(N, M, L) = list(map(int, input().split()))
A = [int(x) for x in input().split()]
ans = 0
i = 0
while i < N:
	j = i
	while j < N and A[j] > L:
		j += 1
	if j > i:
		ans += 1
		i = j + 1
	else:
		i += 1
for mi in range(M):
	line = input()
	if len(line) == 1:
		print(ans)
	else:
		(t, p, d) = list(map(int, line.split()))
		prev = A[p - 1]
		A[p - 1] += d
		if prev <= L < A[p - 1]:
			if p - 2 >= 0 and p < N:
				if A[p - 2] > L and A[p] > L:
					ans -= 1
				elif A[p - 2] <= L and A[p] <= L:
					ans += 1
				else:
					pass
			elif p - 2 >= 0:
				if A[p - 2] > L:
					pass
				else:
					ans += 1
			elif p < N:
				if A[p] > L:
					pass
				else:
					ans += 1
			else:
				ans += 1


import sys
q = sys.stdin.readline()
(n, m, l) = map(int, q.split())
a = [-1]
a += map(int, sys.stdin.readline().split())
a.append(-1)
n += 2
time = sum((1 for i in range(1, n - 1) if a[i] > l and a[i - 1] <= l))
res = []
for i in range(m):
	b = sys.stdin.readline().split()
	if b[0] == '0':
		res.append(str(time))
	else:
		(_, p, d) = map(int, b)
		if a[p] <= l and a[p] + d > l:
			cond = (a[p - 1] <= l) + (a[p + 1] <= l)
			time += cond == 2
			time -= cond == 0
		a[p] += d
print('\n'.join(res))


import sys

def count_it():
	return len(''.join(list([' ' if x <= l else '1' for x in h])).split())
(n, m, l) = list([int(x) for x in sys.stdin.readline().split(' ')])
h = list([int(x) for x in sys.stdin.readline().split(' ')])
k = count_it()
for mi in range(m):
	request = sys.stdin.readline().split(' ')
	if len(request) == 1:
		print(k)
	else:
		(r, p, d) = list([int(x) for x in request])
		h[p - 1] += d
		if h[p - 1] > l and h[p - 1] - d <= l:
			if n == 1:
				k += 1
			elif p - 1 == 0 and h[1] <= l or (p == len(h) and h[p - 2] <= l) or (h[p - 2] <= l and h[p] <= l):
				k += 1
			elif p - 1 != 0 and p != len(h) and (h[p - 2] > l) and (h[p] > l):
				k -= 1


(n, m, l) = list(map(int, input().split()))
a = input().split()
b = [0] * n
for i in range(n):
	b[i] = int(a[i])
count = 0
for i in range(n):
	if b[i] > l:
		count += 1
		if i > 0:
			if b[i - 1] > l:
				count -= 1
for i in range(m):
	t = input().split()
	if int(t[0]) == 0:
		print(count)
	else:
		p = int(t[1])
		d = int(t[2])
		if b[p - 1] <= l:
			b[p - 1] += d
			if b[p - 1] > l:
				if n == 1:
					count += 1
				elif p - 1 > 0 and p - 1 < n - 1:
					if b[p - 2] > l and b[p] > l:
						count -= 1
					elif b[p - 2] <= l and b[p] <= l:
						count += 1
				elif p - 1 == n - 1:
					if b[p - 2] <= l:
						count += 1
				elif b[p] <= l:
					count += 1


(nHairs, nCuts, cutTo) = [int(x) for x in input().split()]
hair = list(map(int, input().split())) + [0]
time = 0
inCut = False
for j in range(nHairs + 1):
	time += 1 * (hair[j] > cutTo and (not inCut))
	inCut = hair[j] > cutTo
T = []
for i in range(nCuts):
	line = input().split()
	if line[0] == '1':
		l = int(line[1]) - 1
		h = hair[l]
		hair[l] += int(line[2])
		if h <= cutTo and hair[l] > cutTo:
			time += 1
			time -= hair[l - 1] > cutTo
			time -= hair[l + 1] > cutTo
	else:
		T.append(str(time))
print('\n'.join(T))


def main():
	(n, m, l) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = 0
	for i in range(1, n):
		if A[i] > l >= A[i - 1]:
			ans += 1
	if A[0] > l:
		ans += 1
	babans = []
	for _ in range(m):
		Z = list(map(int, input().split()))
		if len(Z) == 1:
			babans.append(ans)
		else:
			(t, p, d) = Z
			if p != 1 and p != n:
				if A[p - 1] + d > l >= A[p - 1]:
					x = A[p - 2]
					y = A[p]
					if x > l and y > l:
						ans -= 1
					elif x <= l and y <= l:
						ans += 1
			elif p == 1 and n != 1:
				if A[p - 1] + d > l >= A[p - 1]:
					if A[p] <= l:
						ans += 1
			elif p == n and n != 1:
				if A[p - 1] + d > l >= A[p - 1]:
					if A[p - 2] <= l:
						ans += 1
			elif A[p - 1] + d > l >= A[p - 1]:
				ans += 1
			A[p - 1] += d
	print('\n'.join(list(map(str, babans))))
main()


import sys
(nbmeches, nbreq, l) = list(map(int, sys.stdin.readline().split()))
meches = list(map(int, sys.stdin.readline().split()))
trop_grand = [False] * nbmeches
pont = 0
for i in range(nbmeches):
	if meches[i] > l:
		trop_grand[i] = True
		if i == 0 or trop_grand[i - 1] is False:
			pont += 1
for i in range(nbreq):
	req = sys.stdin.readline().split()
	if int(req[0]) == 0:
		print(pont)
	else:
		meches[int(req[1]) - 1] += int(req[2])
		if meches[int(req[1]) - 1] > l and (not trop_grand[int(req[1]) - 1]):
			trop_grand[int(req[1]) - 1] = True
			if nbmeches == 1:
				pont = 1
			elif int(req[1]) - 1 == 0 and (not trop_grand[int(req[1])]):
				pont += 1
			elif not int(req[1]) - 1 == 0 and int(req[1]) - 1 == nbmeches - 1 and (not trop_grand[int(req[1]) - 2]):
				pont += 1
			elif not int(req[1]) - 1 == 0 and (not int(req[1]) - 1 == nbmeches - 1) and trop_grand[int(req[1])] and trop_grand[int(req[1]) - 2]:
				pont = max(0, pont - 1)
			elif not int(req[1]) - 1 == 0 and (not int(req[1]) - 1 == nbmeches - 1) and (not trop_grand[int(req[1])]) and (not trop_grand[int(req[1]) - 2]):
				pont += 1


(n, m, length_) = [int(s) for s in input().split(' ')]
a = [int(s) for s in input().split(' ')]
result = 0
prev = None
for i in range(n):
	if prev and prev <= length_:
		if a[i] > length_:
			result += 1
	if not prev and a[i] > length_:
		result += 1
	prev = a[i]
for i in range(m):
	temp = input()
	if temp == '0':
		print(result)
	else:
		(_, p, d) = [int(s) for s in temp.split(' ')]
		num = p - 1
		cm = d
		old_val = a[num]
		a[num] += cm
		if old_val > length_:
			continue
		if a[num] <= length_:
			continue
		if num != 0 and num != n - 1:
			if a[num - 1] > length_ and a[num + 1] > length_:
				result -= 1
			elif a[num - 1] <= length_ and a[num + 1] <= length_:
				result += 1
		elif num == 0 and (len(a) == 1 or a[1] <= length_):
			result += 1
		elif num == n - 1 and a[n - 2] <= length_:
			result += 1


3

def readint():
	return int(input())

def readline():
	return [int(c) for c in input().split()]

def compute_time(a, l):
	cnt = 0
	prev = -1
	for e in a:
		if e > l and prev <= l:
			cnt += 1
		prev = e
	return cnt

def main():
	(n, m, l) = readline()
	a = readline()
	time = compute_time(a, l)
	for i in range(m):
		q = readline()
		if q[0] == 0:
			print(time)
		else:
			(p, d) = (q[1], q[2])
			is_left_short = True if p == 1 or a[p - 2] <= l else False
			is_right_short = True if p == n or a[p] <= l else False
			if is_left_short and is_right_short and (a[p - 1] <= l) and (a[p - 1] + d > l):
				time += 1
			elif not is_left_short and (not is_right_short) and (a[p - 1] <= l) and (a[p - 1] + d > l):
				time -= 1
			a[p - 1] += d

def __starting_point():
	main()
__starting_point()


(n, m, l) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n):
	if a[i] > l and (i == 0 or a[i - 1] <= l):
		count += 1
for i in range(m):
	le = list(map(int, input().split()))
	if le[0] == 1:
		a[le[1] - 1] += le[2]
		if a[le[1] - 1] - le[2] <= l and a[le[1] - 1] > l:
			if le[1] - 2 >= 0 and a[le[1] - 2] <= l and (le[1] < n) and (a[le[1]] <= l):
				count += 1
			elif le[1] - 2 >= 0 and a[le[1] - 2] <= l and (le[1] >= n):
				count += 1
			elif le[1] - 2 < 0 and le[1] < n and (a[le[1]] <= l):
				count += 1
			elif le[1] - 2 < 0 and le[1] >= n:
				count += 1
			if le[1] - 2 >= 0 and a[le[1] - 2] > l and (le[1] < n) and (a[le[1]] > l):
				count -= 1
	else:
		print(count)


def main():
	buf = input()
	buflist = buf.split()
	n = int(buflist[0])
	m = int(buflist[1])
	l = int(buflist[2])
	buf = input()
	buflist = buf.split()
	a = list(map(int, buflist))
	need_cut = []
	for i in a:
		if i > l:
			need_cut.append(True)
		else:
			need_cut.append(False)
	cut_count = 0
	segmented = False
	for i in need_cut:
		if not segmented and i:
			cut_count += 1
			segmented = True
		elif segmented and (not i):
			segmented = False
	for i in range(m):
		buf = input()
		buflist = buf.split()
		q = int(buflist[0])
		if q == 0:
			print(cut_count)
		elif q == 1:
			p = int(buflist[1]) - 1
			d = int(buflist[2])
			a[p] += d
			if p == 0:
				if not need_cut[p] and a[p] > l:
					need_cut[p] = True
					if n == 1:
						cut_count += 1
					elif not need_cut[p + 1]:
						cut_count += 1
			elif p == n - 1:
				if not need_cut[p] and a[p] > l:
					need_cut[p] = True
					if not need_cut[p - 1]:
						cut_count += 1
			elif not need_cut[p] and a[p] > l:
				need_cut[p] = True
				if not need_cut[p - 1] and (not need_cut[p + 1]):
					cut_count += 1
				elif need_cut[p - 1] and need_cut[p + 1]:
					cut_count -= 1
main()


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def solve(adj, colors, n):
	pass
(n, m, l) = rinput()
a = rlinput()
a.insert(0, 0)
a.insert(n + 1, 0)
ans = 0
i = 1
while i < n + 1:
	j = i
	flag = False
	while a[j] > l:
		flag = True
		j += 1
	if flag:
		ans += 1
	i = j + 1
for _ in range(m):
	q = rlinput()
	if q[0] == 0:
		print(ans)
	else:
		if a[q[1]] > l:
			continue
		a[q[1]] += q[2]
		if a[q[1]] > l:
			if a[q[1] - 1] <= l and a[q[1] + 1] <= l:
				ans += 1
			elif a[q[1] - 1] > l and a[q[1] + 1] > l:
				ans -= 1


import sys
(n, m, l) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
on = False
count = 0
for val in a:
	new_on = val > l
	if not on and new_on:
		count += 1
	on = new_on
for i in range(m):
	line = list(map(int, sys.stdin.readline().split()))
	if line[0] == 0:
		print(count)
		continue
	pos = line[1] - 1
	if a[pos] > l:
		continue
	a[pos] += line[2]
	if a[pos] <= l:
		continue
	if n == 1:
		count += 1
		continue
	if pos == 0:
		if a[1] <= l:
			count += 1
		continue
	if pos == n - 1:
		if a[n - 2] <= l:
			count += 1
		continue
	if (a[pos - 1] > l) != (a[pos + 1] > l):
		continue
	if a[pos - 1] > l:
		count -= 1
	else:
		count += 1


from sys import stdin

def preprocess(n, l, a):
	cut = [int(x > l) for x in a]
	i = 0
	ans = 0
	while i < n:
		if cut[i] == 1:
			ans += 1
			j = i + 1
			while j < n and cut[j]:
				j += 1
			i = j
		else:
			i += 1
	return ans

def main():
	(n, m, l) = map(int, input().strip().split())
	a = [int(x) for x in stdin.readline().strip().split()]
	ans = preprocess(n, l, a)
	for i in range(m):
		line = stdin.readline().strip().split()
		if len(line) == 1:
			print(ans)
		else:
			(_, p, d) = map(int, line)
			p -= 1
			if a[p] <= l and a[p] + d > l:
				if (p - 1 >= 0 and a[p - 1] > l) and (p + 1 <= n - 1 and a[p + 1] > l):
					ans -= 1
				elif p - 1 >= 0 and a[p - 1] > l:
					ans = ans
				elif p + 1 <= n - 1 and a[p + 1] > l:
					ans = ans
				else:
					ans += 1
			a[p] += d
main()


(n, m, l) = map(int, input().split())
hair = list(map(int, input().strip().split()))
mark = 0
time = 0
hair.append(-1)
for i in range(0, n + 1):
	if (hair[i] > l) & (mark == 0):
		mark = 1
	elif (hair[i] <= l) & (mark == 1):
		mark = 0
		time += 1
for i in range(0, m):
	request = input()
	if request[0] == '0':
		print(time)
	if request[0] == '1':
		(m, p, d) = map(int, request.split())
		pos = p - 1
		if hair[pos] <= l:
			hair[pos] = hair[pos] + d
			if hair[pos] > l:
				if (hair[pos - 1] > l) & (hair[pos + 1] > l):
					time -= 1
				elif (hair[pos - 1] <= l) & (hair[pos + 1] <= l):
					time += 1
		else:
			hair[pos] = hair[pos] + d


(n, m, l) = [int(c) for c in input().split()]
a = [int(c) for c in input().split()]
cut = [False] + [e > l for e in a]
time = sum((1 for i in range(1, n + 1) if cut[i] and (not cut[i - 1])))
for i in range(m):
	line = input()
	if line == '0':
		print(time)
	else:
		(_, p, d) = [int(c) for c in line.split()]
		p -= 1
		if a[p] <= l and a[p] + d > l:
			cond = (p == 0 or a[p - 1] <= l) + (p == n - 1 or a[p + 1] <= l)
			time += cond == 2
			time -= cond == 0
		a[p] += d


def inters(x1, y1, x2, y2):
	return max(0, min(y1, y2) - max(x1, x2) + 1)
(n, m, l) = map(int, input().split())
vol = [0] + list(map(int, input().split()))
vol.append(-1)
cnt_long_groups = 0
prev_is_short = True
for i in range(n + 1):
	if vol[i] > l:
		if prev_is_short:
			prev_is_short = False
			cnt_long_groups += 1
	else:
		prev_is_short = True
for turn in range(m):
	instring = input().strip()
	if instring == '0':
		print(cnt_long_groups)
	else:
		(_, p, d) = map(int, instring.split())
		if vol[p] > l:
			continue
		vol[p] += d
		if vol[p] <= l:
			continue
		choice = (vol[p - 1] <= l) + (vol[p + 1] <= l)
		if choice == 0:
			cnt_long_groups -= 1
		elif choice == 2:
			cnt_long_groups += 1


import sys
(n, m, l) = list(map(int, sys.stdin.readline().split()))
arr = list(map(int, sys.stdin.readline().split()))
temp = []
ans = 0
f = 0
for i in arr:
	if i > l:
		temp += [1]
	else:
		temp += [0]
for i in range(n):
	if temp[i] == 1 and f == 0:
		f = 1
		ans += 1
	elif temp[i] == 1 and f == 1:
		pass
	elif temp[i] == 0:
		f = 0
for i in range(m):
	x = sys.stdin.readline()
	if x[0] == '0':
		sys.stdout.write(str(ans) + '\n')
	else:
		(_, p, d) = list(map(int, x.split()))
		p -= 1
		if p - 1 < 0:
			low = False
		else:
			low = True
		if p + 1 < n:
			high = True
		else:
			high = False
		if temp[p] == 0 and arr[p] + d > l:
			temp[p] = 1
			if low and high:
				if temp[p - 1] == 0 and temp[p + 1] == 0:
					ans += 1
				elif temp[p - 1] == 1 and temp[p + 1] == 1:
					ans -= 1
			elif not low and (not high):
				if ans == 0:
					ans += 1
			elif p == 0:
				if high:
					if temp[p + 1] == 0:
						ans += 1
			elif p == n - 1:
				if low > -1:
					if temp[p - 1] == 0:
						ans += 1
		else:
			arr[p] += d


(n, m, k) = map(int, input().split())
a = [-float('inf')] + list(map(int, input().split())) + [-float('inf')]
ans = sum((a[q] <= k < a[q + 1] for q in range(n + 1)))
for _ in range(m):
	d = list(map(int, input().split()))
	if d[0] == 0:
		print(ans)
	else:
		(q, x) = (d[1], d[2])
		if a[q - 1] > k and a[q + 1] > k and (a[q] + x > k >= a[q]):
			ans -= 1
		elif a[q - 1] <= k and a[q + 1] <= k and (a[q] + x > k >= a[q]):
			ans += 1
		a[q] += x


import sys
(hair_n, request_n, fav) = map(int, input().split())
hair = [-1] + list(map(int, sys.stdin.readline().split())) + [-1]
ans = 0
new = False
for i in range(1, hair_n + 1):
	if hair[i] > fav and new == False:
		ans += 1
		new = True
	elif hair[i] <= fav:
		new = False
for r in range(request_n):
	query = list(map(int, sys.stdin.readline().split()))
	if query[0] == 1:
		growing_hair = query[1]
		change = query[2]
		prev_hair = hair[growing_hair]
		hair[growing_hair] += change
		if hair[growing_hair] > fav and prev_hair <= fav:
			ans += 1
			if hair[growing_hair - 1] > fav:
				ans -= 1
			if growing_hair < hair_n:
				if hair[growing_hair + 1] > fav:
					ans -= 1
	else:
		print(ans)


(n, m, l) = list(map(int, input().split()))
a = list(map(int, input().split()))
cuts = 0
prev = False
for i in range(n):
	if a[i] > l:
		if prev:
			continue
		else:
			cuts += 1
			prev = True
	else:
		prev = False
for _ in range(m):
	s = input()
	if s.startswith('0'):
		print(cuts)
	else:
		(p, d) = list(map(int, s[1:].split()))
		p -= 1
		if a[p] <= l and a[p] + d > l:
			t = (p - 1 in range(n) and a[p - 1] > l) + (p + 1 in range(n) and a[p + 1] > l)
			if t == 0:
				cuts += 1
			elif t == 1:
				pass
			else:
				cuts -= 1
		a[p] += d


from sys import stdin
(n, m, l) = map(int, input().split())
hair = [-1]
inp = [int(i) for i in input().split()]
hair += inp
hair.append(-1)
if hair[0] <= l:
	cuts = 0
else:
	cuts = 1
for i in range(1, len(hair)):
	if hair[i] > l and hair[i - 1] <= l:
		cuts += 1
for i in range(m):
	req = stdin.readline().split()
	if req[0] == '0':
		print(cuts)
	else:
		numb = int(req[1])
		long = int(req[2])
		if hair[numb] <= l:
			hair[numb] += long
			if hair[numb] > l:
				if hair[numb - 1] > l and hair[numb + 1] > l:
					cuts -= 1
				elif hair[numb - 1] <= l and hair[numb + 1] <= l:
					cuts += 1


(n, m, l) = list(map(int, input().split()))
al = list(map(int, input().split()))
num_cuts = sum([al[0] > l] + [al[i] <= l and al[i + 1] > l for i in range(n - 1)])
for _ in range(m):
	q = list(map(int, input().split()))
	if q[0] == 0:
		print(num_cuts)
		continue
	i = q[1] - 1
	if al[i] > l:
		continue
	al[i] += q[2]
	if al[i] <= l:
		continue
	mleft = i > 0 and al[i - 1] > l
	mright = i < n - 1 and al[i + 1] > l
	if mleft and mright:
		num_cuts -= 1
	if not mleft and (not mright):
		num_cuts += 1


import configparser
import sys
input = sys.stdin.readline

def ceil_div(x, y):
	return -(-x // y)

def main():
	(n, m, l) = [int(x) for x in input().split(' ')]
	a = [int(x) for x in input().split(' ')]
	i = 0
	cnt = 0
	part = [False for i in range(n)]
	while i < len(a):
		while i < len(a) and a[i] <= l:
			i += 1
		if i == len(a):
			break
		while i < len(a) and a[i] > l:
			part[i] = True
			i += 1
		cnt += 1
	for i in range(m):
		p = [int(x) for x in input().split(' ')]
		if p[0] == 0:
			print(cnt)
		else:
			hair = p[1] - 1
			grow = p[2]
			a[hair] += grow
			if part[hair] or a[hair] <= l:
				continue
			part[hair] = True
			if n == 1:
				cnt += 1
				continue
			if hair == 0:
				if not part[hair + 1]:
					cnt += 1
			elif hair == n - 1:
				if not part[hair - 1]:
					cnt += 1
			elif not part[hair - 1] and (not part[hair + 1]):
				cnt += 1
			elif part[hair - 1] and part[hair + 1]:
				cnt -= 1
main()


import sys

def Find(parent, x):
	if parent[x] != x:
		parent[x] = Find(parent, parent[x])
	return parent[x]

def Union(parent, rank, x, y):
	x_root = Find(parent, x)
	y_root = Find(parent, y)
	if x_root == y_root:
		return
	if rank[x_root] < rank[y_root]:
		parent[x_root] = y_root
	elif rank[x_root] > rank[y_root]:
		parent[y_root] = x_root
	else:
		parent[x_root] = y_root
		rank[y_root] += 1
(hair_n, request_n, fav) = map(int, sys.stdin.readline().split())
hair = [-1] + list(map(int, sys.stdin.readline().split()))
parent_list = [i for i in range(hair_n + 1)]
rank_list = [0 for i in range(hair_n + 1)]
ans = 0
for i in range(1, hair_n):
	if hair[i] > fav and hair[i + 1] > fav:
		Union(parent_list, rank_list, i, i + 1)
for i in range(1, hair_n + 1):
	if i == parent_list[i] and hair[i] > fav:
		ans += 1
for r in range(request_n):
	query = list(map(int, sys.stdin.readline().split()))
	if query[0] == 1:
		growing_hair = query[1]
		change = query[2]
		prev_hair = hair[growing_hair]
		hair[growing_hair] += change
		if hair[growing_hair] > fav and prev_hair <= fav:
			ans += 1
			if hair[growing_hair - 1] > fav:
				ans -= 1
			if growing_hair < hair_n:
				if hair[growing_hair + 1] > fav:
					ans -= 1
	else:
		print(ans)