n = gets.to_i
size = n*(n-1)/2
array = []

(1..n).each do |i|
  (i+1..n).each do |j|
    array.push([i,j])
  end
end
tmp = []
if n % 2 == 0
  array.each {|a|
    if a[0] + a[1] == n+1
      tmp.push(a)
    end
  }
else
  array.each {|a|
    if a[0] + a[1] == n
      tmp.push(a)
    end
  }
end

tmp.each {|a|
  array.delete(a)
}

puts array.size
array.each {|a|
  puts "#{a[0]} #{a[1]}"
}
