require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i

is_odd = false
if n.odd?
  is_odd = true
  n -= 1
end

ans = []
1.upto(n) do |i|
  (i+1).upto(n) do |j|
    if i != j && i + j != n + 1
      ans.push [i, j]
    end
  end
end

if is_odd
  1.upto(n) do |i|
    ans.push [i, n+1]
  end
end

puts ans.size
ans.each do |line|
  puts line.join(' ')
end