import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val ans = mutableListOf<Pair<Int,Int>>()
    val s = if (n % 2 == 0) n + 1 else n
    for (i in 1..n) {
        for (j in (i+1)..n) {
            if (i + j != s) {
                ans.add(Pair(i, j))
            }
        }
    }
    println(ans.size)
    for (p in ans) {
        println("${p.first} ${p.second}")
    }
}