n = gets.to_i

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

list.sort! {|a, b| a[1] == b[1] ? a[0] <=> b[0] : a[1] <=> b[1]}
a = list[0]
used = []
loop do
  used << a
  b = list[0]
  1.upto(n-1){|i|
    c = list[i]
    if b == a
      b = c
    else
      v = (b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0])
      if v > 0 || (v == 0 && (c[0]-a[0])**2+(c[1]-a[1])**2 > (b[0]-a[0])**2+(b[1]-a[1])**2)
        b = c
      end
    end
  }
  a = b
  break if a == used[0]
end

p used.reverse

while s != used[0]
  used.push(used.shift)
end
puts used.size
used.each{|pt|
  puts "#{pt[0]} #{pt[1]}"
}