Need help coding a loop to trigger after a certain number of times

Did you see the counting scheme in the State Change Detection built-in example?

If you understand state-change detection, and how that example works, it should be straightforward.