We’ll start by assuming that it’s been two hours since the first cab left X. Consider one taxi departing from Y at this precise moment; taxis will depart at 10-minute intervals throughout the route at this precise moment. All taxis on the road that started from X, including the taxi that just arrived at Y, and all taxis that will start from X until this taxi from Y arrives at X, will pass this taxi from Y at some point. So, initially, we’ll figure out how many cabs are blocking the road.
There will be 11 taxis on the way because all cabs are 10 minutes apart and a one-way trip takes 2 hours. Because they are not en way, the taxi that arrived at Y and the taxi that will arrive at X are not counted. After this taxi leaves and takes 2 hours to get to X, 12 other cabs must have left from X, all of which will pass this taxi from Y. As a result, a total of 23 taxis from X will meet each taxi from Y and vice versa.