n = int(input()) ans = [[] for i in range(2 * n - 1)] for val in reversed(range(2 * n - n + 1, 2 * n)): for i in range(val): ans[i].append(val) idx = 0 for val in reversed(range(1, 2 * n - n + 1)): rev = -1 for i in range(val): if i < 2: ans[idx].append(val) idx += 1 else: ans[rev].append(val) rev -= 1 print(len(ans)) for res in ans: print(*res)