import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt

  val ans = Array.fill[List[Int]](N+1)(List[Int]())
  var cnt = 0
  if(N % 2 == 0) {
    for (i <- 1 to N) {
      for (k <- i+1 to N) {
        if (k != N+1 - i){
          ans(i) = k :: ans(i)
          cnt += 1
        }
      }
    }
  }
  else {
    for (i <- 1 to N-1) {
      for (k <- i+1 to N) {
        if (k != N - i) {
          ans(i) = k :: ans(i)
          cnt += 1
        }
      }
    }
  }

  pw.println(cnt)
  for (i <- 1 to N) {
    for (e <- ans(i)) {
      pw.println(s"$i $e")
    }
  }
  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

