n = gets.chomp.to_i

if n % 2 == 0
  groups = (1..(n / 2)).map { |i| [i, n + 1 - i] }
else
  groups = (1..(n / 2)).map { |i| [i, n - i] }
  groups.push([n])
end

graphs = []
groups.combination(2) do |groupa, groupb|
  groupa.each { |i|  groupb.each { |j| graphs.push([i, j]) } }
end

n = graphs.length
puts n

graphs.each { |graph| puts(graph.join(' ')) }