N=int(input()) A=list(map(int,input().split())) ans=[] i=N-2 d=0 while i>=0: while i>0 and A[i]==A[i+1]: i-=1 ans.append((1,i+1,A[-1]-A[i]-d)) d+=A[-1]-A[i]-d i-=1 print(len(ans)) for a in ans: print(*a)