If i'm understanding your implementation properly, then I don't think that will work. For all intents and purposes, units wont ever execute code at the same time. They will run serially, one after the other.
Each Gardener will run the same code, separately and serially. If you increment the count at the beginning of your loop and then set it to 0 at the end of your loop, each Gardener will increase the count from 0 -> 1 at the start of its turn, and then set the count back to 0 at the end of its turn, leaving the next Gardener with a count of 0 and each one thinking they're the only one.
I've successfully implemented this in the past, and dealt with several bugs and issues that hopefully you can avoid now with some guidance. Instead, what you can do is:
To keep track of any/all unit types EXCEPT for Archons, add to your Archon code: (In this case, we'll track Soldiers)
// ARCHON CODE
// CHANNEL_SOLDIER_COUNT contains the accurate final count of your Soldiers. Read this when you need to know how many Soldiers you have
// CHANNEL_SOLDIER_SUM contains a running sum of the Soldiers. It wont be accurate until *all* of Soldiers run, so DONT use this to know how many soldiers you have
and to Soldier code
// SOLDIER CODE
Each Soldier will increase the running sum of Soldiers by one on its turn, but you'll need two channels to keep track of it accurately because if you use only one channel, units reading the channel to get the Soldier count too early will find it inaccurate because there may be Soldiers that execute after them which haven't been added to the sum yet. Similarly, Soldiers cant be in charge of resetting their own counter to 0 because they don't know how many more Soldiers are left. (If they did, you wouldn't need to count them!) Archons make a good choice to reset the counter, because they naturally execute before all other Robots do.
It's much more difficult to keep track of the number of Archons with this strategy, though, for the same reason: Archons cant accurately keep track of their own counters, because they don't know how many more Archons there are left to execute.
You can make similar Archon-counting channels, which the Archons can increment, and have some other unit-type (or all types) be in charge of resetting it to 0. But this will be inaccurate in situations where you only have Archons remaining (Such as the beginning of the game, or late game if all of your units are destroyed) because there will be nothing to reset the count to 0, and the counter will keep running up. (Similarly, if all your Archons die, your other-unit counts will be inaccurate. Previously, this hasn't been an issue, but this year losing all your Archons isn't an immediate loss)
A note of caution, though: Implementing this count this way will make your Robots very noisy. There isn't much direct cost to the bots for being noisy this year, in terms of delay or bytecodes, but broadcasting bots are trackable this year. That is, enemies can query for a list of Robots which have broadcasted recently, and that list would contain all of your bots. One tip to mitigate this (slightly) may be to only perform counts on certain turns, say once every 2 or 5 or 10 turns. Be aware of this potential danger, and count responsibly!