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

pt = []
n.times{|i|
  pt[i] = gets.split.map(&:to_f)
}

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

uh = [pt[0],pt[1]]
lh = [pt[-1],pt[-2]]

2.upto(pt.size-1){|i|
  n = uh.size - 1
  while n >= 1 && ccw(uh[n-1], uh[n], pt[i]) > 0
    uh.pop
    n -= 1
  end
  uh.push(pt[i])
}

(pt.size-3).downto(0){|i|
  n = lh.size - 1
  while n >= 1 && ccw(lh[n-1], lh[n], pt[i]) > 0
    lh.pop
    n -= 1
  end
  lh.push(pt[i])
}

hull = (lh + uh).uniq.reverse

nh = hull.size

start = 0
spt = [hull[0][0], hull[0][1]]
nh.times{|i|
  if hull[i][1] == spt[1] ? hull[i][0] < spt[0] : hull[i][1] < spt[1]
    spt = [hull[i][0], hull[i][1]]
    start = i
  end
}

puts nh
nh.times{|i|
  j = (i+start) % nh
  puts "%d %d" % hull[j]
}