n=gets.to_i
group=[]
if n.odd?
  group << [n]
  n-=1
end

(n/2).times{|i|
  group << [i+1,n-i]
}

ans=[]
group.combination(2){|g1,g2|
  g1.each{|v1|
    g2.each{|v2|
      ans << [v1,v2]
    }
  }
}

puts ans.size
ans.each{|pair|
  puts pair*" "
}
