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

checked = []
checked_gone = []
town.each_with_index do |t, i|
  now = t
  gone = [t]
  can = []
  town_clone = town.clone

  loop do
    town_clone = town_clone - can - gone
    town_clone.each do |xx, yy|
      can << [xx, yy] if (xx < now[0] && yy < now[1]) || (xx > now[0] && yy > now[1])
    end
    can.sort!

    gone << now
    gone.uniq!

    break if can.length == 0

    index = checked.index(now)
    if index
      gone += checked_gone[index]
      can -= checked_gone[index]
    end
    gone.uniq!

    break if can.length == 0
    now = can.shift
  end
  checked[i] = t
  checked_gone[i] = gone
  (gone - checked).each do |g|
    ti = town.index(g)
    if ti
      checked[ti] = town[ti]
      checked_gone[ti] = gone
    end
  end
  puts gone.length
end
