Every algorithm that explores possibilities needs counting. Dynamic programming counts subproblems. Backtracking counts paths. Probability counts outcomes.
If your code generates passwords, you need to know how many exist. If your code finds paths on a grid, you need to count them. If your code checks all options, you need to know when that's impossible.
Counting tells you if a problem is solvable in reasonable time. 10^6 options? Fine. 10^20? Your code will never finish.