Counting Intersections

HDU - 5862