fun main(args: Array<String>) {
    val n=readLine()!!.toInt()
    val m = if(n%2==0)n*(n-2)/2 else (n-1)*(n-1)/2
    val n2 = n-n%2
    val n3 = n-n%2+1
    println(m)
    for (i in 0 until n2){
        for(j in i+1 until n2){
            if(i+j+2!=n3){
                print(i+1)
                print(" ")
                println(j+1)
            }
        }
    }
    if(n%2==1)
        for(i in 0 until n2){
            print(i+1)
            print(" ")
            println(n)
        }
}