count objects dynamically