Hi,
Add an instance variable (example: "Class number") to your object.
To check how many there are you can write:
System: Every tick >
(sub-event) Object: compare instance variable (value=x) > System: set Global variable to Object.PickedCount
Hope this helps!