OK, thank you, guys - "object count" solution is clever.
I considered using a for loop, because I wanted to avoid creating global variables for this kind of tasks. It's a pitty, that you can't use local variables as an iterator, because they are reseted every tick.