Drop the for each, and change the instance variable back to its original state in the same event.
+on your trigger, set instance variable to 1
+instance variable =1, system add 1 to global variable, instance set variable back to 0
If you need to keep the instance from changing again, add a condition for that.
Here is a tut on how to use for each properly.