N=gets.to_i.times.map{gets.split.map(&:to_i)} (1 .. gets.to_i).group_by{|i|x,y=gets.split.map(&:to_i);N.count{|a,b|x<=a&&y>=b}}.then{|h|puts (m=h.keys.max)==0?0:h[m]}