Path Counting for Grid-Based Navigation