You're given an array a of length n. You can perform the following operations on it:

  * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to all the elements in the prefix ending at i. 
  * choose an index i (1 ≤ i ≤ n), an integer x (1 ≤ x ≤ 10^6), and replace a_j with a_j \% x for all (1 ≤ j ≤ i), which means replace every element in the prefix ending at i with the remainder after dividing it by x. 



Can you make the array strictly increasing in no more than n+1 operations?

Input

The first line contains an integer n (1 ≤ n ≤ 2000), the number of elements in the array a.

The second line contains n space-separated integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^5), the elements of the array a.

Output

On the first line, print the number of operations you wish to perform. On the next lines, you should print the operations.

To print an adding operation, use the format "1 i x"; to print a modding operation, use the format "2 i x". If i or x don't satisfy the limitations above, or you use more than n+1 operations, you'll get wrong answer verdict.

Examples

Input

3
1 2 3


Output

0

Input

3
7 6 3


Output

2
1 1 1
2 2 4

Note

In the first sample, the array is already increasing so we don't need any operations.

In the second sample:

In the first step: the array becomes [8,6,3].

In the second step: the array becomes [0,2,3].

Difficulty: MEDIUM
Tags: Greedy algorithms

Mathematics

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
prime = []

def SieveOfEratosthenes():
	n = 6000
	global prime
	prime = [True for q in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
SieveOfEratosthenes()
I = input
n = int(I())
a = list(map(int, I().split()))
p = 0
i = n * 2 + 1
while True:
	if prime[i] == True:
		p = i
		break
	i += 1
ans = ['2 ' + str(n) + ' 1', '1 ' + str(n) + ' ' + str(p)]
for i in range(n - 1):
	ans.append('2 ' + str(i + 1) + ' ' + str(p - i))
print(n + 1)
for i in ans:
	print(i)


n = int(input())
l = list(map(int, input().split()))
print(n)
print(1, n, 2 * n)
for i in range(n - 1):
	print(2, i + 1, l[i] + 2 * n - i)


n = int(input())
arr = list(map(int, input().split()))
add = 0
print(n + 1)
for i in range(n):
	ind = n - 1 - i
	arr[ind] = arr[ind] + add
	res = n - arr[ind] % n + ind
	add = add + res
	print('1', ind + 1, res)
print('2', n, n)


n = int(input())
a = list(map(int, input().split()))
p = 2039
i = n
s = 0
print(n + 1)
while i > 0:
	i -= 1
	j = a[i] + s
	j = j % p
	j = (i - j + p) % p
	s += j
	print(1, i + 1, j)
print(2, n, p)


def is_increasing(a):
	for i in range(len(a) - 1):
		if a[i] >= a[i + 1]:
			return False
	return True

def apply_add(a, i, x):
	for j in range(i):
		a[j] += x

def apply_mod(a, i, x):
	for j in range(i):
		a[j] %= x

def check(a, ops, print_progress=False):
	assert len(ops) <= len(a) + 1
	for (t, i, x) in ops:
		assert t in (1, 2)
		assert t == 1 and 0 <= x <= 10 ** 6 or (t == 2 and 1 <= x <= 10 ** 6)
		assert 1 <= i <= len(a)
		operation = apply_add if t == 1 else apply_mod
		operation(a, i, x)
		if print_progress:
			print(*a)
	assert is_increasing(a)

def solve(a):
	if is_increasing(a):
		return
	p = len(a)
	for i in reversed(range(len(a))):
		diff = p + i - a[i] % p
		apply_add(a, i + 1, diff)
		yield (1, i + 1, diff)
	yield (2, len(a), p)

def main():
	n = int(input())
	a = list(map(int, input().split()))
	ops = list(solve(a))
	print(len(ops))
	for (t, i, x) in ops:
		print(t, i, x)
main()


input()
all_sum = 0
output = []
a = [int(x) for x in input().split()]
for _ in range(len(a)):
	i = len(a) - 1 - _
	a[i] += all_sum
	output.append(f'1 {i + 1} {(i - a[i]) % (len(a) + 1)}')
	all_sum += len(a) + 1 + i - a[i]
	all_sum %= len(a) + 1
output.append(f'2 {len(a)} {len(a) + 1}')
print(len(output))
for x in output:
	print(x)


from math import *
n = int(input())
arr = list(map(int, input().split()))
print(n + 1)
ansarr = []
count = 0
count1 = 1
for i in range(n - 1, -1, -1):
	temp = arr[i] + count
	temp1 = ceil(temp / (n + 1))
	temp1 = (temp1 + 1) * (n + 1)
	temp1 -= count1
	temp2 = temp1 - temp
	count += temp2
	ansarr.append('1 ' + str(i + 1) + ' ' + str(temp2))
	count1 += 1
ansarr.append('2 ' + str(n) + ' ' + str(n + 1))
print(*ansarr)


n = int(input())
a = list(map(int, input().rstrip().split()))
print(n + 1)
print(1, n, 900000)
for i in range(n):
	print(2, i + 1, a[i] + 900000 - i)


n = int(input())
print(n + 1)
s = list(map(int, input().split()))
print('1 {} 500000'.format(n))
for i in range(n):
	print('2 {0} {1}'.format(i + 1, s[i] + 500000 - i))


n = int(input())
m = 10 ** 6 - 1
a = [int(i) % m for i in input().split()]
l = 0
s = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	a[i] = (a[i] + s) % m
	k = m - n + i - a[i]
	if k < 0:
		k += m
	s += k
	s %= m
	a[i] += k
	a[i] %= m
	print(1, i + 1, k)
print(2, n, m)


n = int(input())
a = [int(x) for x in input().split()]
print(n + 1)
print(1, n, 10 ** 4)
b = [0 for i in range(n)]
for i in range(n):
	b[i] += a[i] + 10 ** 4
c = 0
for i in range(n):
	print(2, i + 1, b[i] + c)
	c -= 1


n = int(input())
a = list(map(int, input().split()))
i = len(a) - 1
mod = int(1000000.0)
cur = mod - 1
print(n + 1)
while i >= 0:
	el = a[i]
	el %= mod
	x = (cur - el + mod) % mod
	print(1, i + 1, x)
	for j in range(i + 1):
		a[j] += x
	cur -= 1
	i -= 1
print(2, n, mod)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
print(1, n, 10 ** 6 - a[-1] - 1)
sum = 10 ** 6 - a[-1] - 1
for i in range(1, n):
	print(1, n - i, max(10 ** 6 - (a[n - i - 1] + sum) % 10 ** 6 - i - 1, 0) + min(10 ** 6, 10 ** 6 - (a[n - i - 1] + sum) % 10 ** 6 - i - 1 + 10 ** 6) % 10 ** 6)
	sum += max(10 ** 6 - (a[n - i - 1] + sum) % 10 ** 6 - i - 1, 0) + min(10 ** 6, 10 ** 6 - (a[n - i - 1] + sum) % 10 ** 6 - i - 1 + 10 ** 6) % 10 ** 6
print(2, n, 10 ** 6)


n = int(input())
if n == 1:
	print(0)
	exit()
print(n + 1)
t = 99999
add = 9999
print(2, n, 1)
print(1, n, t)
for i in range(n - 2):
	print(1, i + 1, add)
print(2, n - 1, add + 1)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(n,) = aj()
A = aj()
if n == 1:
	print(0)
	exit(0)
tot = 0
p = 2 * 10 ** 5
print(n + 1)
for i in range(n):
	req = p - (A[n - i - 1] + tot) % p + (n - i)
	tot += req
	print(1, n - i, req)
print(2, n, p)


n = int(input())
l = list(map(int, input().split()))
ans = []
for i in range(n):
	l[i] += 150000
ans.append([1, n, 150000])
for i in range(n):
	ans.append([2, i + 1, l[i] - i])
print(n + 1)
for i in range(n + 1):
	print(' '.join(map(str, ans[i])))


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
s = 0
x = 0
for i in range(n):
	r = (n - i - (s + a[n - i - 1]) % (n + 1)) % (n + 1)
	print(1, n - i, r)
	s += r
print(2, n, n + 1)


n = int(input())
a = list(map(int, input().split()))
if a == sorted(a) and len(set(a)) == n:
	print(0)
else:
	print(n + 1)
	print(*[1, n, 5 * 100000])
	for i in range(n):
		print(*[2, i + 1, a[i] + 500000 - i])


n = int(input())
a = list(map(int, input().split(' ')))
print(n + 1)
print(1, n, 10 ** 5)
for i in range(n):
	a[i] = a[i] + 10 ** 5
for i in range(n):
	k = a[i] - i
	print(2, i + 1, k)


import sys

def main():
	n = int(sys.stdin.readline())
	x = list(map(int, sys.stdin.readline().split()))
	MOD = int(100000.0 + 1)
	print(n + 1)
	add = 0
	for i in range(n - 1, -1, -1):
		x[i] += add
		if x[i] % MOD == i:
			print(1, i + 1, 0)
		elif x[i] % MOD < i:
			print(1, i + 1, i - x[i] % MOD)
			add += i - x[i] % MOD
		else:
			q = i + MOD - x[i] % MOD
			print(1, i + 1, q)
			add += q
	print(2, n, MOD)
main()


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, deque
from itertools import permutations
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 = I()
ls = lint()
print(n + 1)
print(2, n, 1)
print(1, n, 10 ** 6)
for i in range(1, n):
	print(2, i, 1000000 - i)
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


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 = 5 * 10 ** 5 + 7

def op1(ind, x):
	for i in range(ind):
		a[i] += x
n = I()
a = L()
print(n + 1)
k = 1
for i in range(n - 1, -1, -1):
	m = (a[i] // (n + 1) + 2) * (n + 1) - k - a[i]
	op1(i + 1, m)
	print(1, i + 1, m)
	k += 1
print(2, n, n + 1)


n = int(input())
arr = list(map(int, input().strip().split()))
k = 0
for i in range(n - 1):
	if arr[i] >= arr[i + 1]:
		k = 1
		break
if k == 0:
	print(0)
else:
	s = 0
	print(n + 1)
	for i in range(n - 1, -1, -1):
		x = n - (arr[i] + s) % n + i
		print('1 ' + str(i + 1) + ' ' + str(x))
		s += x
	print('2 ' + str(n) + ' ' + str(n))


n = int(input())
l = list(map(int, input().split()))
x1 = l
print(n + 1)
a = 0
for i in range(n - 1, -1, -1):
	x = (n + i - (a + l[i]) % n) % n
	a += x
	x1[i] += a
	print(1, i + 1, x)
print(2, n, n)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
i = n - 1
while i >= 0:
	x = 0
	while x + i - a[i] < 0:
		x += 10 ** 6
	print(1, i + 1, x + i - a[i])
	for j in range(i + 1):
		a[j] += x + i - a[i]
	i -= 1
print(2, n, 10 ** 6)


n = int(input())
lst = list(map(int, input().strip().split(' ')))
print(n + 1)
print(1, n, 5000, end=' ')
print()
for j in range(n):
	print(2, j + 1, lst[j] + 5000 - j, end=' ')
	print()


n = int(input())
l = [*map(int, input().split())]
print(n + 1)
curr = 0
for i in range(n - 1, -1, -1):
	print(f'1 {i + 1} {i + -(curr + l[i]) % n}')
	curr += i + -(curr + l[i]) % n
print(f'2 {n} {n}')


n = int(input())
y = input()
inlist = y.split(' ')
for ii in range(n):
	inlist[ii] = int(inlist[ii])
n_n = max(inlist) + 300000
qq = 1
print(n + 1)
print(str(1) + ' ' + str(n) + ' ' + str(n_n))
for i in range(n):
	if (n_n + inlist[i]) % (n_n + inlist[i] - qq) == 0:
		x = n_n + inlist[i] - qq - 1
		qq = qq + 2
	else:
		x = n_n + inlist[i] - qq
		qq = qq + 1
	print(str(2) + ' ' + str(i + 1) + ' ' + str(x))


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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')

def main():
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print(0)
		return
	s = 0
	print(n + 1)
	for i in range(len(a) - 1, -1, -1):
		add = (i - (a[i] + s) % n + n) % n
		print(1, i + 1, add)
		s += add
	print(2, n, n)
main()


n = int(input())
arr = [int(a) for a in input().strip().split(' ')]
rems = [a for a in range(n)]
tt = []
for x in range(n - 1, -1, -1):
	if (rems[x] - arr[x] % n) % n != 0:
		tt.append([1, x + 1, (rems[x] - arr[x] % n) % n])
		arr = list(map(lambda temp: temp + (rems[x] - arr[x] % n) % n, arr[:x + 1])) + arr[x + 1:len(arr)]
arr = list(map(lambda temp: temp % n, arr))
tt.append([2, n, n])
print(len(tt))
for i in range(len(tt)):
	print(tt[i][0], tt[i][1], tt[i][2])


n = int(input())
l = list(map(int, input().split()))
x = 10 ** 5
print(n + 1)
print(1, n, x)
for i in range(n):
	print(2, i + 1, l[i] + x - i)


n = int(input())
a = [int(i) for i in input().split()]
add = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	d = (n + i - (a[i] + add) % n) % n
	print(1, i + 1, d)
	add += d
	add = add % n
print(2, n, n)


n = int(input())
arr = list(map(int, input().split()))
print(n + 1)
count = 1
for i in range(n - 1, -1, -1):
	add_num = n * 2 - arr[i] % n - count
	print(1, i + 1, add_num)
	for j in range(i + 1):
		arr[j] += add_num
	count += 1
print(2, n, n)


n = int(input())
A = [int(x) for x in input().split(' ')]
result = []

def add(i, x):
	result.append('1 {} {}'.format(i + 1, x))
	for j in range(i + 1):
		A[j] += x

def mod(i, x):
	result.append('2 {} {}'.format(i + 1, x))
	for j in range(i + 1):
		A[j] %= x
for i in reversed(range(n)):
	if A[i] % (n + 1) > i + 1:
		add(i, i + 1 + (n + 1) - A[i] % (n + 1))
	elif A[i] % (n + 1) < i + 1:
		add(i, i + 1 - A[i] % (n + 1))
if len(result) > 0:
	mod(n - 1, n + 1)
print(len(result))
for s in result:
	print(s)


import os, 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 math import ceil
mod = 10 ** 9 + 7
for _ in range(1):
	n = int(input())
	l = list(map(int, input().split()))
	print(n + 1)
	max_ = 500000
	print(1, n, max_)
	i = 0
	while n:
		print(2, i + 1, max_ + l[i] - i)
		i += 1
		n -= 1


n = int(input())
a = list(map(int, input().split()))
s = 0
i = n - 1
ans = []
while i != -1:
	m = (a[i] + s) % n
	if m < i:
		s += i - m
		ans.append([1, i + 1, i - m])
	else:
		s += n - m + i
		ans.append([1, i + 1, n - m + i])
	i -= 1
ans.append([2, n, n])
print(len(ans))
for i in ans:
	print(i[0], i[1], i[2])


n = int(input())
MOD = 10 ** 5
s = list(map(int, input().split()))
r = []
for i in range(n - 1, -1, -1):
	k = (MOD + i - s[i]) % MOD
	if k == 0:
		continue
	for j in range(0, i + 1):
		s[j] += k
	r.append((1, i + 1, k))
print(len(r) + 1)
for (a, b, c) in r:
	print(a, b, c)
print(2, n, MOD)


n = int(input())
print(n + 1)
arr = list(map(int, input().split()))
print(1, n, n * 2)
for i in range(n):
	x = arr[i] + n * 2
	print(2, i + 1, x - i)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
added = 0
opers = []
for i in range(n - 1, -1, -1):
	toadd = (i - (a[i] + added) % n) % n
	if not toadd:
		continue
	added += toadd
	opers += [(1, i + 1, toadd)]
opers += [(2, n, n)]
print(len(opers))
for oper in opers:
	print(*oper)


n = int(input())
a = list(map(int, input().split()))
z = 1999
x = 0
flag = True
for i in range(1, n):
	if a[i] <= a[i - 1]:
		flag = False
if not flag:
	print(n + 1)
	for i in range(n - 1, -1, -1):
		k = 2000 - (a[i] + x) % 2000
		print(1, i + 1, k + z)
		x = (x + k + z) % 2000
		z -= 1
	print(2, n, 2000)
else:
	print(0)


from sys import stdin, stdout

class Solve:

	def __init__(self):
		R = stdin.readline
		W = stdout.write
		n = int(input())
		a = [int(x) + 100000 for x in R().split()]
		ans = [str(n + 1), '1 ' + str(n) + ' 100000']
		for i in range(n):
			ans.append('2 ' + str(i + 1) + ' ' + str(a[i] - i))
		W('\n'.join(ans))

def main():
	s = Solve()
main()


n = int(input())
l = input()
print(n + 1)
print(2, n, 1)
print(1, n, 10 ** 6)
for i in range(1, n):
	print(2, i, 1000000 - i + 1)


n = int(input())
a = list(map(int, input().split()))
print(n)
print(1, n, 3 * n)
for i in range(n - 1):
	print(2, i + 1, a[i] + 3 * n - i)


n = int(input())
numbers = str(input()).split()
numbers = [int(i) for i in numbers]

def check(mylist):
	ci = 1
	cj = 0
	while ci < len(mylist):
		if mylist[ci] <= mylist[cj]:
			return 0
		ci += 1
		cj += 1
	return 1
if check(numbers):
	print('0')
else:
	print(n)
	print('1 ' + str(n) + ' ' + '20001')
	for i in range(len(numbers)):
		numbers[i] += 20001
	li = 20001
	j = 1
	for i in range(len(numbers) - 1):
		print('2 ' + str(i + 1) + ' ' + str(numbers[i] - j))
		numbers[i] = numbers[i] % (numbers[i] - j)
		j += 1


n = int(input())
a = [-1] + [int(x) for x in input().split()]
print(n + 1)
print(1, n, 100000)
for i in range(1, n + 1):
	a[i] += 100000
for i in range(1, n + 1):
	x = a[i] - i
	print(2, i, x)
	a[i] %= x


(l, line) = (int(input()), list(map(int, input().split(' '))))
mod = l
added = 0
print(l + 1)
for i in range(l - 1, -1, -1):
	line[i] += added
	n = mod + mod + i - line[i] % mod
	added += n
	line[i] += n
	print(1, i + 1, n)
print(2, l, mod)


N = int(input())
aN = list(map(int, input().split()))
print(N + 1)
for i in range(N - 1, -1, -1):
	add_num = N * 2 - aN[i] % N + i
	print(1, i + 1, add_num)
	for j in range(i + 1):
		aN[j] += add_num
print(2, N, N)
for i in range(N):
	aN[i] %= N


n = int(input())
a = list(map(int, input().split()))
curr = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	curr = (i - a[i]) % n
	for j in range(i):
		a[j] += curr
	print(f'1 {i + 1} {curr}')
print(f'2 {n} {n}')


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
print(1, n, 50000)
for k in range(n):
	print('2 {} {}'.format(k + 1, a[k] + 50000 - k))


from sys import stdin, exit, setrecursionlimit
setrecursionlimit(100000000)
from math import *
from bisect import bisect_left
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
n = int(input())
a = lmi()
ops = []
arr = [0] * (n + 1)
cur = 0
for i in range(n - 1, -1, -1):
	a[i] += cur
	tmp = a[i] + (n - a[i] % n)
	arr[i + 1] = tmp + i - a[i]
	cur += tmp + i - a[i]
print(n + 1)
for i in range(1, n + 1):
	print(1, i, arr[i])
print(2, n, n)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

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()
n = int(input())
l = list(numIN())
l = [i + 900000 for i in l]
print(n + 1)
print(1, n, 900000)
for i in range(n):
	print(2, i + 1, l[i] - i)


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(n, a) = na()
sm = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	dop = (i - (a[i] + sm) % n + n) % n
	print(1, i + 1, dop)
	sm += dop
print(2, n, n)


def main():
	buf = input()
	n = int(buf)
	buf = input()
	buflist = buf.split()
	a = list(map(int, buflist))
	op = []
	for i in range(n - 1, -1, -1):
		add_num = (n - a[i]) % n + i
		for j in range(i + 1):
			a[j] += add_num
		if add_num > 0:
			op.append((1, i + 1, add_num))
	for i in range(n):
		a[i] %= n
	op.append((2, n, n))
	print(len(op))
	for e in op:
		print(e[0], e[1], e[2])
main()


def mainA():
	n = int(input())
	if n == 1:
		print(-1)
	else:
		print(n, n)

def mainB():
	(n, k) = map(int, input().split())
	a = set([int(e) for e in input().split()])
	a = [0] + sorted(a)
	for i in range(1, min(k + 1, len(a))):
		print(a[i] - a[i - 1])
	if k > len(a) - 1:
		for i in range(k - len(a) + 1):
			print(0)

def mainC():
	n = int(input())
	a = [int(e) + 800000 for e in input().split()]
	print(n)
	print(1, n, 800000)
	for i in range(n - 1):
		print(2, i + 1, a[i] - i)
mainC()


n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n - 1, -1, -1):
	q = a[i] % n
	w = i - q
	if w < 0:
		w += n
	ans.append(w)
	for j in range(0, i + 1):
		a[j] += w
print(n + 1)
for i in range(n):
	print(1, n - i, ans[i])
print(2, n, n)


n = int(input())
l = list(map(int, input().split()))
sum1 = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	cur = (l[i] + sum1) % n
	cur = (i - cur) % n
	sum1 = (sum1 + cur) % n
	print(1, i + 1, cur)
print(2, n, n)


n = int(input())
lis = list(map(int, input().split()))
c = 0
ans = []
k = n - 1
for i in range(n - 1, -1, -1):
	if lis[i] + c <= i:
		ans.append([1, i + 1, i - lis[i] - c])
		c += i - lis[i] - c
	else:
		req = (lis[i] + c) % n
		aa = n - req + i
		c += n - req + i
		ans.append([1, i + 1, aa])
ans.append([2, n, n])
print(len(ans))
for i in ans:
	print(*i)


n = int(input())
T = input().split(' ')
for i in range(n):
	T[i] = int(T[i])
k = n
r = 0
s = 0
print(n + 1)
while k >= 1:
	a = n - (T[k - 1] + s) % n
	print(1, end=' ')
	print(k, end=' ')
	print(a + k - 1)
	s += a + k - 1
	k -= 1
	r += 1
print(2, end=' ')
print(n, end=' ')
print(n)


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(test,) = Neo()
n = test
A = Neo()
if n == 1:
	print(0)
	exit()
print(n + 1)
k = 0
for i in range(n - 1, -1, -1):
	t = i + 1 + n - A[i] % n
	k += t
	print(1, i + 1, t)
	if i > 0:
		A[i - 1] += k
print(2, n - 1, n)


n = int(input())
arr = [x + 20000 for x in list(map(int, input().split()))]
inc = 0
ops = list()
ops.append((1, n, 20000))
for (idx, v) in enumerate(arr):
	idx += 1
	ops.append((2, idx, v - idx))
print(len(ops))
for (a, b, c) in ops:
	print(a, b, c)


n = int(input())
nums = list(map(int, input().split()))
modn = len(nums) + 1
suma = 0
ans = []
for i in range(len(nums) - 1, -1, -1):
	summod = (nums[i] + suma) % modn
	diff = i + 1 - summod
	if diff < 0:
		diff += modn
	if diff > 0:
		suma += diff
		ans += [[1, i + 1, diff]]
if len(ans) > 0:
	print(len(ans) + 1)
	for i in ans:
		print(i[0], i[1], i[2])
	print(2, n, modn)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
(ans, res) = (0, [])
flag = False
summ = 0
for i in range(n - 1, -1, -1):
	a[i] += summ
	cur = a[i] % (n + 1)
	if cur == i + 1:
		continue
	delta = i + 1 + (n + 1 - cur)
	if cur < i + 1:
		delta = i + 1 - cur
	summ += delta
	item = '{} {} {}'.format(1, i + 1, delta)
	ans += 1
	res.append(item)
	if a[i] + delta >= n:
		flag = True
if flag:
	ans += 1
	res.append('{} {} {}'.format(2, n, n + 1))
print(ans)
if ans > 0:
	for j in range(ans):
		print(res[j])


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
print(n + 1)
asum = 0
for i in range(n - 1, -1, -1):
	add = (i - (a[i] + asum) % n + n) % n
	print(1, end=' ')
	print(i + 1, end=' ')
	print(add)
	asum += add
print(2, end=' ')
print(n, end=' ')
print(n, end=' ')


import sys
ADD = 555555

def solve(io):
	N = io.read_int()
	A = io.read_int_array(N)
	io.println(N + 1)
	io.println(1, N, ADD)
	for (i, a) in enumerate([a + ADD for a in A]):
		io.println(2, i + 1, a - i)

class IO:
	in_stream = None
	out_stream = None
	raw = ''
	buf = []
	pos = 0

	def __init__(self, input_stream, output_stream):
		self.in_stream = input_stream
		self.out_stream = output_stream

	def read_to_buffer(self):
		self.raw = self.in_stream.readline().rstrip('\n')
		self.buf = self.raw.split()
		self.pos = 0

	def read_string(self):
		while self.pos == len(self.buf):
			self.read_to_buffer()
		ans = self.buf[self.pos]
		self.pos += 1
		return ans

	def read_int(self):
		return int(self.read_string())

	def read_float(self):
		return float(self.read_string())

	def read_string_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_string())
		return arr

	def read_int_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_int())
		return arr

	def read_float_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_float())
		return arr

	def read_line(self):
		while self.pos == len(self.buf):
			self.read_to_buffer()
		if self.pos > 0:
			raise ValueError('Cannot call read_line in the middle of a line.')
		self.pos = len(self.buf)
		return self.raw

	def print(self, *args):
		self.out_stream.write(' '.join([str(x) for x in args]))

	def println(self, *args):
		self.print(*args)
		self.print('\n')

	def println_array(self, arr, sep=' '):
		self.println(sep.join((str(x) for x in arr)))

	def flush_output(self):
		self.out_stream.flush()
pythonIO = IO(sys.stdin, sys.stdout)
solve(pythonIO)
pythonIO.flush_output()


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
a = listIn()
a = list(map(lambda x: x + 100 * n + 1, a))
print(n + 1)
print(1, n, 100 * n + 1)
mod_arr = [0] * n
b = a.copy()
for i in range(n):
	mod_arr[i] = a[i] - i
	print(2, i + 1, mod_arr[i])
	for j in range(i + 1):
		b[j] = b[j] % mod_arr[i]


n = int(input())
v = list(map(int, input().split()))
rest = n - 1
print(n + 1)
for i in range(n - 1, -1, -1):
	add = n - v[i] % n + rest
	print('1 ' + str(i + 1) + ' ' + str(add))
	for j in range(i + 1):
		v[j] += add
	rest -= 1
print('2 ' + str(n) + ' ' + str(n))


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
ips = lambda : input().split()
t = ii()
a = ll()
a = [-1] + a
add = 500000
ans = []
ans.append([1, t, add])
for i in range(1, t + 1):
	ans.append([2, i, add + a[i] - i])
print(len(ans))
for i in ans:
	print(*i)


n = int(input())
l = list(map(int, input().split()))
s = 0
if sorted(l) == l and [l[0]] * n != l:
	print(s)
else:
	k = n + 1
	ll = []
	s = k - 1
	for i in range(n - 1, -1, -1):
		if l[i] % k == s:
			pass
		else:
			kk = 0
			if l[i] % k > s:
				kk = k - l[i] % k + s
			else:
				kk = s - l[i] % k
			ll.append([1, s, kk])
			for i in range(s):
				l[i] += kk
		s -= 1
	ll.append([2, n, k])
	print(len(ll))
	for i in ll:
		print(*i)


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
cnt = 0
s = ''
for i in range(n, 0, -1):
	a[i - 1] += sum1
	sum2 = (i - a[i - 1] % (n + 1)) % (n + 1)
	if sum2 != 0:
		s += '1 ' + str(i) + ' ' + str(sum2) + '\n'
		cnt += 1
	sum1 += sum2
print(cnt + 1)
print(s)
print(2, n, n + 1)


n = int(input())
x = list(map(int, input().split()))
c = []
t = 0
y = x
ans = []
for i in range(n - 1, -1, -1):
	x[i] += t
	c.append((i + 1 - x[i]) % (n + 1))
	t += (i + 1 - x[i]) % (n + 1)
	ans.append('1 ' + str(i + 1) + ' ' + str((i + 1 - x[i]) % (n + 1)))
ans.reverse()
ans.append('2 ' + str(n) + ' ' + str(n + 1))
print(n + 1)
for i in range(n + 1):
	print(ans[i])


n = int(input())
a = list(map(int, input().split()))
vr = -1
tag = False
for i in a:
	if i > vr:
		vr = i
	else:
		tag = True
if tag:
	md = len(a)
	st = []
	for i in a:
		st.append(i % md)
	x = len(a) - 1
	op = []
	v = 0
	for i in range(n - 1, -1, -1):
		if (st[i] + v) % md == x:
			x = x - 1
		else:
			if (st[i] + v) % md < x:
				v1 = x - (st[i] + v) % md
				v += v1
			else:
				v1 = md - (st[i] + v) % md + x
				v += v1
			x = x - 1
			op.append([1, i + 1, v1])
	op.append([2, n, md])
	print(len(op))
	for i in op:
		print(i[0], i[1], i[2])
else:
	print(0)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
if n == 1:
	print(0)
	exit(0)
print(n + 1)
print(2, n, 1)
print(1, n, 17669)
for i in range(n - 1):
	print(2, i + 1, 17669 - i)


n = int(input())
ar = [int(j) for j in input().split()]
x = ar[0]
flag = True
for t in ar[1:]:
	if x < t:
		x = t
	else:
		flag = False
		break
if flag or n == 1:
	print(0)
else:
	print(n + 1)
	print(2, n, 1)
	print(1, n, 5 * 10 ** 5)
	for i in range(n - 1):
		print(2, i + 1, 5 * 10 ** 5 - i - 1)


n = int(input())
ar = list(map(int, input().split(' ')))
print(n + 1)
print(2, n, 1)
print(1, n, 84673)
for i in range(1, n):
	print(2, i, 84673 - i)


n = int(input())
a = list(map(int, input().split()))
diffs = [0 for _ in range(n)]
total = 0
for i in range(n - 1, -1, -1):
	curr = a[i] + total
	for j in range(n):
		if (curr + j) % n == i:
			break
	diffs[i] = j
	total += diffs[i]
print(n + 1)
for i in range(n):
	print(1, i + 1, diffs[i])
print(2, n, n)


n = int(input())
a = []
array = list(map(int, input().split()))
a.extend(array)
add = 500000
if sorted(a) == a and (not all((i == a[0] for i in a))) or len(a) == 1:
	print('0')
else:
	for i in range(n):
		a[i] = a[i] + add
	print(str(n + 1))
	print('1', str(n), str(add))
	for i in range(n):
		print('2', str(i + 1), str(a[i] - i))


n = int(input())
nums = list(map(int, input().split()))
mod = n
added = 0
print(n + 1)
for tar_val in reversed(range(n)):
	to_add = tar_val + mod - (nums[tar_val] + added)
	to_add %= mod
	print(1, tar_val + 1, to_add)
	added += to_add
print(2, n, mod)


n = int(input())
l = list(map(int, input().split()))
print(n + 1)
s = 0
for i in range(n - 1, -1, -1):
	add = (i - (l[i] + s) % n + n) % n
	s += add
	print(1, i + 1, add)
print(2, n, n)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
q1 = 0
for q in range(n):
	f = (a[-q - 1] + q1) % n
	print(1, n - q, (n - 1 - f - q) % n)
	q1 += (n - 1 - f - q) % n
print(2, n, n)


n = int(input())
l = list(map(int, input().split()))
i = n - 1
som = 0
cnt = n - 1
print(n + 1)
while i > -1:
	e1 = (l[i] + som) % n
	e2 = cnt
	x = (e2 - e1) % n
	som += x
	print(1, i + 1, x)
	i -= 1
	cnt -= 1
print(2, n, n)


from sys import stdin, stdout
n = int(stdin.readline().strip())
s = list(map(int, stdin.readline().strip().split()))
md = 100000
acum = 0
r = str(n + 1) + '\n'
for i in range(n - 1, -1, -1):
	s[i] += acum
	x = s[i] - s[i] // md * md
	y = md + i + 1
	acum += y - x
	r += '1 ' + str(i + 1) + ' ' + str(y - x) + '\n'
r += '2 ' + str(n) + ' 100000\n'
stdout.write(r)


n = int(input())
l = [int(x) + 6010 for x in input().split()]
print(n + 1)
print(1, n, 6010)
for i in range(n):
	print(2, i + 1, l[i] - (i + 1))


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
for i in range(n - 1, -1, -1):
	x = i - a[i] % n + n
	print(1, i + 1, x)
	for j in range(i + 1):
		a[j] += x
print(2, n, n)
for i in range(n):
	a[i] %= n


n = int(input())
tmp = input().split()
arr = []
for i in tmp:
	arr.append(int(i))
for i in range(n):
	arr[i] += 50000
print(n + 1)
print(1, n, 50000)
for i in range(n):
	print(2, i + 1, arr[i] - i)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = il()
print(n + 1)
print(1, n, 500000)
for i in range(n):
	print(2, i + 1, l[i] + 500000 - i)


n = int(input())
a = list(map(int, input().split()))
print('%d' % (n + 1))
print('1 %d 500000' % n)
for i in range(n):
	print('2 %d %d' % (i + 1, a[i] + 500000 - i - 1))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		print(n + 1)
		print(2, n, 1)
		print(1, n, 1000000)
		for i in range(0, n - 1):
			print(2, i + 1, 1000000 - i)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
a = [int(s) for s in input().split()]
print(n + 1)
print(1, n, 800000)
for i in range(n):
	print(2, i + 1, a[i] + 800000 - i)


n = int(input())
a = list(map(int, input().split()))
if all((a[i] < a[i + 1] for i in range(len(a) - 1))):
	print('0')
else:
	print(n + 1)
	print('1', n, 5 * 10 ** 5)
	a = [x + 500000 for x in a]
	for i in range(n):
		print('2', i + 1, a[i] - i)


n = int(input())
l = list(map(int, input().split()))
print(str(n + 1))
ans = 0
for i in range(n - 1, -1, -1):
	cur = (l[i] + ans) % n
	cur = (i - cur) % n
	ans = (ans + cur) % n
	print(1, i + 1, cur)
print(2, n, n)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
i = n
j = n - 1
for x in reversed(a):
	inc = (x - j) % n
	print(1, i, n - inc)
	i -= 1
	j = (j + inc - 1) % n
print(2, n, n)


def mi():
	return map(int, input().split())
n = int(input())
a = list(mi())
i = n - 1
res = 0
temp = []
print(n + 1)
while i >= 0:
	temp = i - (res + a[i]) % n
	if temp < 0:
		temp += n
	res += temp
	print(1, i + 1, temp)
	i -= 1
print(2, n, n)


from sys import stdin
import math

def is_ok(arr):
	for i in range(1, len(arr)):
		if arr[i - 1] >= arr[i]:
			return False
	else:
		return True

def max_mod(num):
	return num // 2 + 1

def magic(arr, num, operation):
	for i in range(len(arr)):
		arr[i] += num
	operation.append([1, n, num])
	i = 0
	while i < n:
		operation.append([2, i + 1, arr[i] - (i + 1)])
		for j in range(i + 1):
			arr[j] %= arr[i] - (i + 1)
		i += 1
	for i in range(1, len(arr)):
		if arr[i - 1] >= arr[i]:
			return False
	else:
		return True
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
if is_ok(arr):
	print(0)
	exit()
operation = []
magic(arr, 5 * 100000, operation)
print(len(operation))
for i in range(len(operation)):
	print(*operation[i])


n = int(input())
a = list(map(int, input().split()))
op = []
c = 0
for i in range(n - 1, -1, -1):
	b = (a[i] + c) % n
	if b <= i:
		op.append(i - b)
		c += i - b
	else:
		op.append(i + n - b)
		c += i + n - b
print(n + 1)
for i in range(n):
	print('1', n - i, op[i])
print('2', n, n)


from math import ceil
N = int(input())
A = [int(x) for x in input().split()]
rr = N - 1
s = 0
print(N + 1)
for i in range(N - 1, -1, -1):
	A[i] += s
	x = N - A[i] % N + rr
	s += x
	print(1, end=' ')
	print(i + 1, end=' ')
	print(x)
	rr -= 1
print(2, N, N)


n = int(input())
a = [int(x) for x in input().split()]
print(n + 1)
print(1, n, 100005)
for i in range(n):
	add = a[i] + 100005
	print(2, i + 1, add - i - 1)
	a[i] = add % (add - i - 1)


n = int(input())
l = list(map(int, input().split()))
d = []
d.append([2, n, 1])
d.append([1, n, 10 ** 5])
l = [10 ** 5] * n
for i in range(1, n):
	d.append([2, i, 10 ** 5 - i])
print(len(d))
for i in d:
	print(*i)


from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	l[i] += 5 * 10 ** 5
print(n + 1)
print(1, n, 5 * 10 ** 5)
for i in range(n):
	print(2, i + 1, l[i] - i)


def solve(xs):
	operations = []
	n = len(xs)
	added = 0
	for i in range(len(xs) - 1, -1, -1):
		x = xs[i] + added
		if x % n == i:
			continue
		else:
			to_add = (i - x) % n
			operations.append((1, i + 1, to_add))
			added += to_add
	if operations:
		operations.append((2, n, n))
	return operations

def verify(xs):
	solution = solve(xs)
	assert len(solution) <= len(xs) + 1
	for (op, i, x) in solution:
		if op == 1:
			for j in range(i):
				xs[j] += x
		elif op == 2:
			for j in range(i):
				xs[j] = xs[j] % x
	for i in range(1, len(xs)):
		assert xs[i] > xs[i - 1]
n = int(input())
xs = list(map(int, input().split()))[:n]
solution = solve(xs)
print(len(solution))
for (a, b, c) in solution:
	print(a, b, c)


I = lambda : map(int, input().split())
n = int(input())
a = list(I())
print(n + 1)
su = 0
for i in range(n - 1, -1, -1):
	k = (a[i] + su) % n
	r = i - k
	if r < 0:
		r += n
	su += r
	print(1, i + 1, r)
print(2, n, n)


n = int(input())
arr = [int(x) for x in input().split()]
print(n + 1)
sum = 0
for i in reversed(range(n)):
	arr[i] += sum
	cur = (arr[i] - i + (n - 1)) // n * n + (i - arr[i])
	sum += cur
	print(1, i + 1, cur)
print(2, n, n)


n = int(input())
l = list(map(int, input().split()))
p = 1
t = 400 * 1000
mx = t + len(l)
p = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	a = mx - (p + l[i]) % t
	print(1, i + 1, a)
	p += a
	mx -= 1
print(2, n, t)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
print('1 %d 500000' % n)
for (i, v) in enumerate(a):
	print('2 %d %d' % (i + 1, v + 500000 - i))


n = int(input())
a = [int(x) for x in input().split()]
adds = []
acc = 0
for i in range(n - 1, -1, -1):
	a[i] += acc
	if a[i] % n != i:
		delta = (i - a[i] % n) % n
		adds.append((i + 1, delta))
		acc += delta
print(len(adds) + 1)
for x in adds:
	print(1, *x)
print(2, n, n)


n = int(input())
array = list(map(int, input().split()))
print(n + 1)
add = 0
for i in range(n - 1, -1, -1):
	add = i - array[i] % n
	if add < 0:
		add += n
	print(1, i + 1, add)
	for j in range(i):
		array[j] += add
	add = 0
print(2, n, n)


n = int(input())
li = input().split()
for i in range(n):
	li[i] = int(li[i]) + 500000
print(n + 1)
print(1, n, 500000)
i = 0
while i < n:
	print(2, i + 1, li[i] - (i + 1))
	i += 1


n = int(input())
mass = [int(i) % 2001 for i in input().split()]
summ = 0
print(n + 1)
while n > 0:
	n -= 1
	if (mass[n] + summ) % 2001 == n:
		print(1, n + 1, 0)
	else:
		l = (summ + mass[n]) % 2001
		print(1, n + 1, 2001 - l + n)
		summ = (summ - l + n) % 2001
print(2, len(mass), 2001)


n = int(input())
a = list(map(int, input().split(' ')))

def mod(x):
	return x % (n + 1)

def difMod(x, index):
	m = mod(x)
	m = index - m
	if m < 0:
		m += n + 1
	return m
i = n - 1
s = 0
print(n + 1)
while i >= 0:
	m = difMod(a[i] + s, i)
	s += m
	print(1, i + 1, m)
	i -= 1
print(2, n, n + 1)


R = lambda : list(map(int, input().split()))
(n, a) = (R()[0], R())
print(n + 1)
print(1, n, 100000)
for i in range(n):
	print(2, i + 1, a[i] + 100000 - i)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
arr = lmp()
ansl = []
sm = 0
for i in range(n):
	x = (n - 1 - i - (arr[n - 1 - i] + sm) % n) % n
	sm += x
	ansl.append(x)
print(n + 1)
for i in range(n):
	print(1, n - i, ansl[i])
print(2, n, n)


n = int(input())
l = list(map(int, input().split()))
print(n + 1)
print(1, n, n * 4)
for j in range(n):
	print(2, j + 1, l[j] + 4 * n - j)


n = int(input())
a = list(map(int, input().split()))
if a == sorted(a) and set(a) == n:
	print(0)
else:
	sum = 0
	print(n + 1)
	for i in range(n - 1, -1, -1):
		print(*[1, i + 1, i + n - (a[i] + sum % n) % n])
		sum = sum + i + n - (a[i] + sum % n) % n
	print(*[2, n, n])


n = int(input())
a = [*map(int, input().split())]
print(n + 1)
b = [i + 10 ** 5 for i in a]
print(1, n, 10 ** 5)
print(2, 1, b[0])
for i in range(len(a) - 1):
	print(2, i + 2, b[i + 1] - (i + 1))


import math
n = int(input())
a = list(map(int, input().split()))
b = list(a)
(cnt, count) = (0, 0)
for i in range(n - 1, -1, -1):
	b[i] += count
	if b[i] % n != i:
		tmp = n + i - b[i] % n
		b[i] = b[i] + tmp
		count = count + tmp
		cnt += 1
print(cnt + 1)
count = 0
for i in range(n - 1, -1, -1):
	a[i] += count
	if a[i] != b[i]:
		print(1, i + 1, b[i] - a[i])
		count += b[i] - a[i]
print(2, n, n)


n = input()
_ = input()
n = int(n)
num = 10000
print(n + 1)
print(2, n, 1)
print(1, n, num)
for i in range(n - 1):
	print(2, i + 1, num - i)


n = int(input())
cl = list(map(int, input().split()))
mx = max(cl)
print(n + 1)
print(2, n, 1)
print(1, n, 10000)
for i in range(n - 1):
	print(2, i + 1, 10000 - i)


n = int(input())
seq = list(map(int, input().split()))
tmp = []
total = 0
for i in range(n - 1, -1, -1):
	if (seq[i] + total) % (n + 1) != i + 1:
		tmp.append([1, i + 1, n + 1 - (seq[i] + total) % (n + 1) + i + 1])
		total += n + 1 - (seq[i] + total) % (n + 1) + i + 1
tmp.append([2, n, n + 1])
print(len(tmp))
for t in tmp:
	print(' '.join(map(str, t)))


n = int(input())
print(n + 1)
print(2, n, 1)
print(1, n, 1000000)
for i in range(1, n):
	print(2, i, 1000000 + 1 - i)


from sys import stdin
from sys import stdout
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
ans = []
for i in range(n):
	ans.append(11000 + a[i])
stdout.write(str(n + 1) + '\n')
stdout.write('1 ' + str(n) + ' 11000\n')
for i in range(n):
	stdout.write('2 ' + str(i + 1) + ' ' + str(ans[i] - i) + '\n')


import sys
from math import floor, ceil
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
if sorted(a) == a and len(set(a)) == n:
	print(0)
	sys.exit(0)
ans = []
for i in range(n - 1, -1, -1):
	target = ceil(a[i] / n) * n + i
	d = target - a[i]
	ans.append('1 ' + str(i + 1) + ' ' + str(d))
	for j in range(i + 1):
		a[j] += d
print(len(ans) + 1)
for answer in ans:
	print(answer)
print('2 ' + str(n) + ' ' + str(n))


n = int(input())
a = list(map(int, input().split()))
yo = pow(10, 5) + 5
print(n + 1)
print(1, n, yo)
for i in range(n):
	print(2, i + 1, a[i] + yo - i)


n = int(input())
a = list(map(int, input().split()))
divisor = n + 1
cnt = 0
print(divisor)
for (index, val) in reversed(list(enumerate(a))):
	val += cnt
	nashti = val % divisor
	if nashti < index + 1:
		temp = index + 1 - nashti
	else:
		temp = divisor - nashti + index + 1
	cnt += temp
	print(1, index + 1, temp)
print(2, n, divisor)


n = int(input())
a = list(map(int, input().split()))
print(n + 1)
summ = 0
for i in range(n - 1, -1, -1):
	print('1 ' + str(i + 1) + ' ' + str((i - (a[i] + summ) % n) % n))
	summ = summ + (i - (a[i] + summ) % n) % n
print('2 ' + str(n) + ' ' + str(n))


amount = int(input())
array = [int(s) for s in input().split()]
for i in range(len(array)):
	array[i] += int(5 * 100000.0)
print(amount + 1)
print('1 {0} 500000'.format(str(amount)))
for i in range(len(array)):
	print('2 {0} {1}'.format(str(i + 1), str(array[i] - i)))


n = int(input())
m = list(map(int, input().split()))
t = m.copy()
t.sort()
sol = []
sol.append(str('1 ' + str(n) + ' ' + str(2 * n)))
for i in range(n):
	sol.append(str('2 ' + str(i + 1) + ' ' + str(m[i] + 2 * n - i)))
print(len(sol))
print(*sol, sep='\n')


import sys
import bisect
from collections import deque
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
a = Ri()
print(n + 1)
for i in range(n - 1, -1, -1):
	temp = a[i] % n
	dif = -1
	if i > temp:
		dif = i - temp
	else:
		dif = n - (temp - i)
	print(1, i + 1, dif)
	for j in range(i):
		a[j] = a[j] + dif
print(2, n, n)


R = lambda : map(int, input().split())
n = int(input())
L = list(R())
s = 0
print(n + 1)
for i in reversed(range(n)):
	a = (L[i] + s) % n
	if i - a > 0:
		s += i - a
		print(1, i + 1, i - a)
	else:
		s += i - a + n
		print(1, i + 1, i - a + n)
print(2, n, n)


MOD = 10000

def solve():
	_ = input()
	arr = [int(x) for x in input().split()]
	print(len(arr) + 1)
	total_adds = 0
	for i in reversed(range(len(arr))):
		add_x = (i - (arr[i] + total_adds)) % MOD
		print(1, i + 1, add_x)
		total_adds += add_x
	print(2, len(arr), MOD)
solve()


size = int(input())
arr = list(map(int, input().split()))
const = 500000
print(str(size + 1))
print('1 ' + str(size) + ' ' + str(const))
for i in range(size):
	print('2 ' + str(i + 1) + ' ' + str(arr[i] + const - i))


n = int(input())
a = list(map(int, input().split()))
m = n + 1
s = 0
k = 0
Ans = []
for i in range(n - 1, -1, -1):
	if (a[i] + s) % m == i:
		pass
	elif (a[i] + s) % m < i:
		Ans.append([1, i + 1, i - (a[i] + s) % m])
		s += i - (a[i] + s) % m
		k += 1
	else:
		Ans.append([1, i + 1, m - (a[i] + s) % m + i])
		s += m - (a[i] + s) % m + i
		k += 1
if k > 0:
	print(k + 1)
	for i in range(k):
		print(*Ans[i])
	print(2, n, m)
else:
	print(0)


n = int(input())
arr = list(map(int, input().split()))
print(n + 1)
ss = 0
for i in range(n - 1, -1, -1):
	add = (i - (arr[i] + ss) % n + n) % n
	print(1, i + 1, add)
	ss += add
print(2, n, n)


n = int(input())
arr = list(map(int, input().split()))
k = 100000
moves = [f'1 {n} {100000}']
for i in range(n):
	arr[i] = arr[i] + 100000
	moves.append(f'2 {i + 1} {arr[i] - (i + 1)}')
print(n + 1)
print('\n'.join(moves))


n = int(input())
x = input()
x = x.split()
for i in range(0, n):
	x[i] = int(x[i])
print(n + 1)
print(2, n, 1)
print(1, n, 1000000)
for i in range(0, n - 1):
	print(2, i + 1, 1000000 - i)


import math
n = int(input())
data = list(map(int, input().rstrip().split()))
total = 0
print(str(n + 1))
for i in range(0, n):
	current = (data[n - i - 1] + total) % n
	add = (n - i - 1 - current) % n
	total = total + add
	print('1 ' + str(n - i) + ' ' + str(add))
print('2 ' + str(n) + ' ' + str(n))


n = int(input())
g = list(map(int, input().split()))
ex = n + 1
ans = []
promise = 0
for i in range(n - 1, -1, -1):
	ans.append([1, i + 1, i + 1 + ex - (g[i] + promise) % ex])
	promise += i + 1 + ex - (g[i] + promise) % ex
ans.append([2, n, ex])
print(len(ans))
for i in ans:
	print(*i)


n = int(input())
a = list(map(int, input().split()))
s = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	a[i] += s
	rem = a[i] % n
	if rem <= i:
		diff = i - rem
		s += diff
		print(1, i + 1, diff)
	elif rem > i:
		diff = rem - i
		s += n - diff
		print(1, i + 1, n - diff)
print(2, n, n)


n = int(input())
arr = list(map(int, input().split()))
print(n + 1)
cur = 0
for i in reversed(range(n)):
	k = arr[i] + cur
	d = k // n
	if d * n + i < k:
		d += 1
	ans = d * n + i - k
	print(1, i + 1, ans)
	cur += ans
print(2, n, n)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	n = int(input())
	arr = inar()
	temp = arr.copy()
	count = n - 1
	res = []
	for i in range(n - 1, -1, -1):
		md = arr[i] % n
		if md > count:
			answer = n - md + count
			res.append((1, i + 1, answer))
			for j in range(i, -1, -1):
				arr[j] += answer
		else:
			res.append((1, i + 1, count - md))
			for j in range(i, -1, -1):
				arr[j] += count - md
		count -= 1
	res.append((2, n, n))
	print(n + 1)
	for i in range(len(res)):
		print(*res[i])
main()


n = int(input())
arr = map(int, input().split())
print(n + 1)
print('1', n, 200000)
for (i, a) in enumerate(arr):
	print('2', i + 1, a + 200000 - i - 1)


import sys
n = int(sys.stdin.readline())
a = sys.stdin.readline().split()
print(n + 1)
s = 0
for i in range(0, n):
	x = (3 * 10 ** 5 + n - i - s - int(a[n - i - 1])) % 3000
	print('1 ' + str(n - i) + ' ' + str(x))
	s = (s + x) % 3000
print('2 ' + str(n) + ' 3000')


import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
print(n)
print(1, n, 500000)
for k in range(1, n):
	print(2, k, A[k - 1] + 500000 - k + 1)


x = int(input())
s = list(map(int, input().split()))
print(x + 1)
print(1, x, 500000)
for n in range(x):
	print(2, n + 1, s[n] + 500000 - n)


n = int(input())
L = [int(x) for x in input().split()]
s = 0
print(n + 1)
for i in range(0, n):
	print(1, n - i, (n - i - 1 - s - L[n - i - 1]) % 100000)
	s += (n - i - 1 - s - L[n - i - 1]) % 100000
	s = s % 100000
print(2, n, 100000)


n = int(input())
mas = list(map(int, input().split()))
print(n + 1)
print('1 ' + str(n) + ' 100000')
for (i, x) in enumerate(mas):
	x += 100000 - i - 1
	print('2 ' + str(i + 1) + ' ' + str(x))


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial
M = 100003
n = int(stdin.readline())
vl = list(map(int, stdin.readline().split()))
add = 0
cur = 1
stdout.write(str(n + 1) + '\n')
for i in range(n - 1, -1, -1):
	vl[i] += add
	v = vl[i] % M
	dif = M - cur
	if v <= dif:
		cnt = dif - v
	else:
		cnt = dif - v + M
	cur += 1
	add += cnt
	vl[i] += cnt
	stdout.write('1 ' + str(i + 1) + ' ' + str(cnt) + '\n')
for i in range(n):
	vl[i] %= M
stdout.write('2 ' + str(n) + ' ' + str(M))


import sys

def rint():
	return map(int, sys.stdin.readline().split())
n = int(input())
a = list(rint())
print(n + 1)
b = 10 ** 5
m = b
for i in range(n - 1, -1, -1):
	if (i + b) % m >= a[i]:
		p = (i + b) % m - a[i]
	else:
		p = (i + b) % m - a[i]
		while p < 0:
			p += m
	print(1, i + 1, p)
	for j in range(i + 1):
		a[j] += p
print(2, n, m)


import math
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	mod = 200000
	cong = mod - 1
	add = 0
	print(n + 1)
	for i in range(n - 1, -1, -1):
		a[i] = (a[i] + add) % mod
		k = 0
		if cong - a[i] < 0:
			k += mod - a[i]
			a[i] = 0
		k += cong - a[i]
		print('%d %d %d' % (1, i + 1, k))
		add += k
		cong -= 1
	print('%d %d %d' % (2, n, mod))
main()


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = list(map(int, input().split()))
s = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	a[i] += s
	rem = a[i] % n
	if rem <= i:
		diff = i - rem
		s += diff
		print(1, i + 1, diff)
	elif rem > i:
		diff = rem - i
		s += n - diff
		print(1, i + 1, n - diff)
print(2, n, n)


n = int(input())
a = [int(i) for i in input().split()]
if sorted(a) == a and len(set(a)) != 1:
	print(0)
else:
	print(n + 1)
	print(1, n, 500005)
	for i in range(len(a)):
		a[i] += 500005
	for i in range(n):
		print(2, i + 1, a[i] - i)


n = int(input())
A = list(map(int, input().split()))
print(n + 1)
print('2', n, 1)
print('1', n, '1000000')
for i in range(1, n):
	print('2', i, 1000000 - i)


n = int(input())
a = list(map(int, input().split()))
a.reverse()
MOD_N = 2003
cur_add = 0
total_add = 0
print(n + 1)
for i in range(n):
	c = a[i]
	c_rest = (c + total_add) % MOD_N
	cur_add = n - i + MOD_N - c_rest
	total_add += cur_add
	print('1 {ind} {val}'.format(ind=n - i, val=cur_add))
print('2 {ind} {val}'.format(ind=n, val=MOD_N))


import math
n = int(input())
arr = [int(x) for x in input().split()]
steps = n + 1
ans = []
add = 0
for i in range(n - 1, -1, -1):
	temp = i - (arr[i] + add) % n
	if temp < 0:
		temp = n - (arr[i] + add) % n
		temp += i
	if temp == 0:
		steps -= 1
		continue
	add += temp
	ans.append(1)
	ans.append(i + 1)
	ans.append(temp)
ans.append(2)
ans.append(n)
ans.append(n)
print(steps)
print(*ans)


n = int(input())
a = list(map(int, input().split()))
acc = 0
print(n + 1)
for i in range(n - 1, -1, -1):
	x = (i - (a[i] + acc) % n) % n
	print(1, i + 1, x)
	acc += x
print(2, n, n)


n = int(input())
l = list(map(int, input().split()))
print(n + 1)
s = 0
for i in range(n - 1, -1, -1):
	out = n + 1 - (l[i] + s) % (n + 1) + i + 1
	print('1' + ' ' + str(i + 1) + ' ' + str(out))
	s += out
print('2' + ' ' + str(n) + ' ' + str(n + 1))