import bisect, collections, copy, heapq, itertools, math, string import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) from collections import deque from collections import Counter from collections import defaultdict import bisect from functools import reduce from functools import lru_cache sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD99 = 998244353 def main(): N = I() A = LI() def check(A): if len(set(A)) == 1: return True else: return False ans = 0 anss = [] while not check(A): ans += 1 am = A[-1] now = 2 ** (len(bin(am)) - 3) r = bisect.bisect_left(A, now) anss.append((0, r-1, now)) for i in range(N): if A[i] >= now: A[i] -= now A.sort() print(ans) for l, r, v in anss: print(l, r, v) if __name__ == "__main__": main()