// https://atcoder.jp/contests/agc032/tasks/agc032_b

fun main() {
    agc032b()
}

fun agc032b() {
    val n = readLine()!!.toInt()
    val ans = mutableListOf<String>()
    val isEven = n % 2 == 0
    for (i in 1 until n) {
        for (j in i + 1 .. n) {
            val isLink = if (isEven) {
                linkInEven(i, j, n)
            } else {
                linkInOdd(i, j, n)
            }
            if (isLink) ans.add("$i $j")
        }
    }
    println(ans.size)
    println(ans.joinToString("\n"))
}

private fun linkInOdd(i: Int, t: Int, n: Int): Boolean {
    if (i == t) return false
    if (t == n - i) return false
    return true
}

private fun linkInEven(i: Int, t: Int, n: Int): Boolean {
    if (i == t) return false
    if (t == n - i + 1) return false
    return true
}
