N = gets.to_i

M = []

if N.even?
  (1..N).each do |i|
    ((i+1)..N).each do |j|
      if i + j != N+1
        M << [i,j]
      end
    end
  end
else
  (1..(N-1)).each do |i|
    ((i+1)..N).each do |j|
      if i + j != N
        M << [i,j]
      end
    end
  end  
end

p M.length

M.each do |a, b|
  puts "#{a} #{b}"
end
