import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto m = n * (n - 1) / 2;
		m -= n / 2;
		writeln (m);
		int r = n + !(n & 1);
		foreach (i; 0..n)
		{
			foreach (j; i + 1..n)
			{
				if (i + j + 2 != r)
				{
					writeln (i + 1, " ", j + 1);
				}
			}
		}
	}
}
