Activity Ids & counts for a process definition

I have a BPMN diagram XML data fetched using Camunda REST API.
Now for each of the activity ids(say 30-50 activities) I need to fetch the total activity instance count ***for a process . What is the most optimised way of forming this data in Camunda 7?