import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt

    if (n % 2 == 0) {
      out.println((n * n - 2 * n) / 2)
      for (i <- 1 until n) {
        for (j <- (i + 1) to n) {
          if (n + 1 - j != i) {
            out.println(s"${i} ${j}")
          }
        }
      }
    } else {
      out.println((n * n - 2 * n + 1) / 2)
      for (i <- 1 until n) {
        for (j <- (i + 1) to n) {
          if (n - j != i) {
            out.println(s"${i} ${j}")
          }
        }
      }
    }

    out.flush()
  }
}
