Problem with setting the condition

To clarify, you want to detect how many blocks are in the correct state and then execute something else depending on that state?