import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = ArrayList<List<Int>>()

    if (N % 2 == 0) {
        for (i in 1 .. N / 2) {
            a.add(listOf(i, N + 1 - i))
        }
    } else {
        a.add(listOf(N))
        for (i in 1 .. N / 2) {
            a.add(listOf(i, N - i))
        }
    }

    val edges = ArrayList<List<Int>>()
    for (i in a.indices) {
        for (j in i + 1 until a.size) {
            for (k in a[i]) for (l in a[j]) {
                edges.add(listOf(k, l))
            }
        }
    }
    println(edges.size)
    for (e in edges) {
        println(e.joinToString(" "))
    }
}
