n = gets.chomp.to_i

ary = []
for i in 1..n
    for j in i..n
        if i < j
            ary << [i,j]
        end
    end
end

if n % 2 == 1
    for i in 1..(n-1)
        if i < n-i
            ary.delete([i, n-i])
        else
            ary.delete([n-i, i])
        end
    end
else
    for i in 1..(n-1)
        if i < n-i+1
            ary.delete([i, n-i+1])
        else
            ary.delete([n-i+1, i])
        end
    end
end
puts ary.length
ary.each do |i|
    print(i[0].to_s+" "+i[1].to_s+"\n")
end