for(%i = 0; %i < MainBrickGroup.getCount(); %i++)
{
for(%j = 0; %j < MainBrickGroup.getObject(%i).getCount(); %j++)
{
echo(%j);
}
}
??
Oh wait. This won't add all of them together, it gives you the amount in each brickgroup. As far as adding them all together, I have no idea.