data class Edge(val v1: Int, val v2: Int)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val edges = mutableListOf<Edge>()
  for (v1 in 1..n) {
    for (v2 in (v1 + 1)..n) {
      if (n % 2 == 0) {
        if (v1 + v2 == n + 1) continue
      }
      if (n % 2 == 1) {
        if (v1 + v2 == n) continue
      }
      edges.add(Edge(v1, v2))
    }
  }
  println(edges.size)
  for (edge in edges) {
    println("${edge.v1} ${edge.v2}")
  }
}