n = int(input()) upto = n*2-1 nokorimin = 1 ans = [] for i in range(n-1): next = [i for i in range(upto,n*2)] ind = nokorimin while ind < upto: next.append(ind) ind += 2 ans.append(next) next = [i for i in range(upto,n*2)] ind = nokorimin + 1 while ind < upto: next.append(ind) ind += 2 ans.append(next) upto -= 1 nokorimin += 1 next = [i for i in range(upto,n*2)] ans.append(next) print("{}".format(n*2-1)) for j in range(n*2-1): L=[str(i) for i in ans[j]] L=' '.join(L) print(L)