N=gets.to_i

ret = []
if N.even?
    n = N+1
else
    n = N
end

1.upto(N) do |i|
    (i+1).upto(N) do |j|
        ret << [i,j] if i + j != n
    end
end

puts ret.length
puts ret.map {|a| a.join(' ')}