require 'matrix'

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

s = []
u = []
l = []

gets.to_i.times do
  x, y = gets.split.map &:to_i
  s << Vector[x,y]
end

s.sort! { |a, b| a[0] == b[0] ? a[1] <=> b[1] : a[0] <=> b[0] }

u.push s[0]
u.push s[1]
l.push s[-1]
l.push s[-2]

(2..s.size-1).each do |i|
  n = u.size
  while n >= 2 && cross(s[i]-u[n-2], u[n-1]-u[n-2])  > 0
    u.pop
    n -= 1
  end
  u.push s[i]
end

(s.size - 3).downto(0) do |i|
  n = l.size
  while n >= 2 && cross(s[i]-l[n-2], l[n-1]-l[n-2]) > 0
    l.pop
    n -= 1
  end
  l.push s[i]
end

(1..u.size-2).each do |i|
  l.push u[i]
end

puts l.size
ofs = 0
(0..l.size-1).each do |i|
  if l[ofs][0] > l[i][0]
    ofs = i
  elsif l[ofs][0] == l[i][0]
    if l[ofs][1] > l[i][1]
      ofs = i
    end
  end
end
(0..l.size-1).each do |i|
  j = ( i + ofs ) % l.size
  puts "#{l[j][0]} #{l[j][1]}"
end