I believe the easiest way to do this would be to go through the UI in your environment and go to "deployment status" -> "show all hosts" -> "all Hosts" where it will tell you how many hosts you have connected.
If you have multiple environments you could also use this API endpoint to pull out the information programmatically:
Freshly announced, there is now an EAP for a oneagent API. If you'd like to sign up for that EAP, click the following link: https://www.dynatrace.com/news/blog/manage-thousands-of-hosts-with-the-new-oneagent-on-a-host-rest-a...
This might help fulfill your request.