N=gets.strip.to_i
if N%2==0
  puts (N/2-1)*4
  a=[]
  a[0]=1
  a[1]=N
  (1..N/2-1).each do |i|
    a[2]=a[0]+1
    a[3]=a[1]-1
    (0..1).each do |j|
      (2..3).each do |k|
        puts "#{a[j]} #{a[k]}"
      end
    end
    a[0]=a[2]
    a[1]=a[3]
  end
else
  puts ((N-1)/2-1)*4+2
  puts "1 #{N}"
  puts "#{N-1} #{N}"
  a=[]
  a[0]=1
  a[1]=N-1
  (1..(N-1)/2-1).each do |i|
    a[2]=a[0]+1
    a[3]=a[1]-1
    (0..1).each do |j|
      (2..3).each do |k|
        puts "#{a[j]} #{a[k]}"
      end
    end
    a[0]=a[2]
    a[1]=a[3]
  end
end