Hey,
There is a custom powershell Module :
Install-Module -Name AzDataFactoryV2Activities
The below Blog :
https://datasharkx.wordpress.com/2021/08/17/identifying-the-count-of-activities-within-a-pipeline-in-an-azure-data-factory/
explains the scenario
There is a parallel thread :
https://stackoverflow.com/questions/68982130/how-to-get-count-of-activities-in-an-adf-pipeline