How can I get the quantity of each part or sub-assembly referenced by an assembly with SolidWorks API?

How can I get the quantity of each part or sub-assembly referenced by an assembly with SolidWorks API? 1st level only.

SolidworksApi macros