import java.io.PrintWriter;
import java.util.Scanner;

public class nB {

	Scanner in;
	PrintWriter out;

	void solve() {
		int n = in.nextInt();
		out.println(n - 1);
		for (int i = 0; i < n - 1; i++) {
			for (int j = i; j < n - 1; j++) {
				out.print((j + 1) + " ");
			}
			out.println();
		}
	}

	void run() {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		try {
			solve();
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new nB().run();
	}

}
