let init n f =
  let rec g i ns = if i = 0 then 0 :: ns else g (i - 1) (i :: ns) in
  List.map f (g (n - 1) [])

let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let s = if n mod 2 = 0 then n + 1 else n

let e = List.flatten @@ init (n - 1) (fun i -> init (n - i - 1) (fun j -> (i + 1, i + j + 2)))

let () = 
  let e = e |> List.filter (fun (a, b) -> a + b <> s) in
  Printf.printf "%d\n" (List.length e);
  List.iter (fun (a, b) -> Printf.printf "%d %d\n" a b) e