Do not use `count()` in a `for` loop condition (see #5681)