n = gets.strip.to_i
town = []
n.times do
  x, y = gets.strip.split.map(&:to_i)
  town << [x, y]
end

town.each do |t|
  gone = []
  can = []
  gone << t
  now = t

  loop do
    town.each do |tt|
      next if tt == now
      can << tt if !gone.include?(tt) && ((tt[0] < now[0] && tt[1] < now[1]) || (tt[0] > now[0] && tt[1] > now[1]))
    end

    break if can.length == 0

    now = can.shift
    gone << now
  end
  puts gone.length
end
