import Control.Monad

main = do
    n <- readLn :: IO Int
    let ans = solve n
    print $ length ans
    forM_ ans $ \(i,j) -> do
        putStrLn $ show i ++ " " ++ show j

solve n = if even n then evenSolve n else oddSolve n
    where evenSolve n = [(i,j)| i <- [1..n-1], j<-[i+1..n], i+j /= n+1]
          oddSolve n =  [(i,j)| i <- [1..n-1], j<-[i+1..n], i+j /= n]