To demonstrate the issue, consider four cows with grazing ranges 3..5, 4..8, 1..2, and 5..10; below is a schematic of their grazing ranges: 1 2 3 4 5 6 7 8 9 10 11 12 13 |---|---|---|---|---|---|---|---|---|---|---|---|-... aaaaaaaaa bbbbbbbbbbbbbbbbb ccccc ddddddddddddddddddddd As can be seen, the first, second and fourth cows share the point 5, but the third cow's grazing range is disjoint. Thus, a maximum of 3 cows can have the soda machine within their grazing range.
* Line 1: A single integer: N
* Lines 2..N+1: Line i+1 contains two space-separated integers:and
* Line 1: A single integer representing the largest number of cows whose grazing intervals can all contain the soda machine.