Calculate the minimal value for `count` before the loop, so that you don't need the `if`.