n = gets.to_i
a = Array.new(n).map{Array.new(n,true)}
b = Array.new((n+1)/2).map{[]}
(n/2).times do |i|
    b[i] << i
end
if n%2 == 1
    b[-1] << n-1
end
(n/2).times do |i|
    b[i] << n-i-1
    b[i][1] -= 1 if n%2 == 1
end
b.each do |arr|
    arr.each do |x|
        arr.each do |y|
            a[x][y] = false
        end
    end
end
ans = []
for i in 0..n-2
    for j in i+1..n-1
        ans << [i+1,j+1] if a[i][j]
    end
end
puts ans.size
ans.each do |arr|
    puts arr.join(" ")
end