import Data.List

main = do
  n <- readLn
  let ans = solve n
  print$ length ans
  putStr$ unlines$ map (\(a,b)->unwords.map show$[a,b]) ans

solve n
  | odd n = fromNs ++ (concat.go) (n-1)
  | otherwise = (concat.go) n
  where
  fromNs = zip [1..n-1] $ repeat n
  go n = map f [1..n]
    where
    f i = zip (repeat i) $ delete i.delete (n+1-i) $ [i+1..n]