Counting routes by distance