n = gets.to_i
G = Array.new(n){Array.new(n,true)}
ans = n*(n-1)/2
if n%2 == 0
  (n/2).times do |i|
    G[i][n-i-1] = false
    ans -= 1
  end
else
  ((n-1)/2).times do |i|
    G[i][n-i-2] = false
    ans -= 1
  end
end
p ans
n.times do |i|
  (i+1).upto(n-1) do |j|
    if G[i][j]
      puts "#{i+1} #{j+1}"
    end
  end
end
