fun main(args:Array<String>) {
	val n=readLine()!!.toInt()
	val l=mutableListOf<Pair<Int,Int>>()

	val f=if(n%2==0) n+1 else n
	for(i in 1..n)
		for(j in i+1..n)
			if(i+j!=f)
				l.add(i to j)

	println(l.size)
	for((a,b) in l)
		println("$a $b")
}
