fun main(args: Array<String>) {
    agc032b()
}

fun agc032b() {
    val n = readLine()!!.toInt()

    val all = (1..n).map { left -> (left + 1..n).map { right -> Edge(left, right) } }.flatten()
    val remove = (1..n / 2).map { Edge(it, (n / 2 * 2) - it + 1) }
    val filtered = all.filter { it !in remove }

    val answer = "${filtered.size}" + System.lineSeparator() +
            filtered.joinToString(System.lineSeparator()) { "${it.from} ${it.to}" }

    println(answer)
}

private data class Edge(val from: Int, val to: Int)
