INF = 1.0 / 0.0
n = gets.to_i

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

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

maxp = []
minp = []

(n-1).times{|i|
  max = -INF
  min =  INF
  (i+1).upto(n-1){|j|
    grad = (list[j][1] - list[i][1]).to_f / (list[j][0] - list[i][0]).to_f
    if grad > max
      max = grad
      maxp[i] = j
    end
    if grad < min
      min = grad
      minp[i] = j
    end
  }
}

p = 0
ans = [0]
if minp.size > 0
  while p != n-1
    p = minp[p]
    ans << p
  end
end
up = []
p = 0
if maxp.size > 0
  while p != n-1
    p = maxp[p]
    up.unshift(p)
  end
end
ans += up
ans.uniq!

ans.size.times{|i|
  ans[i] = [list[ans[i]][0], list[ans[i]][1]]
}

start = ans.min{|a, b| a[1] <=> b[1]}

while ans[0] != start
  ans.push(ans.shift)
end
p ans.size
ans.size.times{|i|
  puts "#{ans[i][0]} #{ans[i][1]}"
}