
def ccw(p1, p2, p3)
  return (p2[0]-p1[0])*(p3[1]-p1[1])-(p2[1]-p1[1])*(p3[0]-p1[0])
end

n = gets.to_i

points = []
s = [1.0/0.0, 1.0/0.0]
n.times{|i|
  points[i] = gets.split.map(&:to_i)
  if points[i][1] < s[1] || (points[i][1] == s[1] && points[i][0] < s[0])
    s = [points[i][0],points[i][1]]
  end
}

points -= [s]
points.sort! {|a, b| (b[0]-s[0]).to_f/(b[1]-s[1]) <=>
                     (a[0]-s[0]).to_f/(a[1]-s[1])}
points = [points[-1], s] + points

m = 1
i = 2
loop do
  while ccw(points[m-1], points[m], points[i]) <= 0
    if m > 1
      m -= 1
      next
    elsif i == n
      break
    else
      i += 1
    end
  end

  m += 1
  points[i], points[m] = points[m], points[i]
  i += 1
  break if i > n
end

to = points.shift
used = []
loop do
  used.push(points.shift)
  break if used[-1] == to
end
puts used.size
used.each{|pt|
  puts "#{pt[0]} #{pt[1]}"
}