By my reckoning you example would get the wrong count.
This is why I said my way was more interesting.
Yeah, the count is correct. It relies on the fact the code always gets to the bottom of the block if it does the second comparison. I think doing the count outside of the compare is more of a programmer style challenge.