For the first and last activity, you can use the function:
CALC_THROUGHPUT
There is documentation about it on your help page, via your endpoint and: /help/display/CIBC/CALC_THROUGHPUT
If you like to do it separate for each, you can use the function use source target and time difference.
There is an article on your Celonis help page:
/help/display/CIBC/Throughput+Times
Example:
DAYS_BETWEEN ( SOURCE ( "Activities"."Timestamp" ) , TARGET ( "Activities"."Timestamp" ) )
Via using remap values, you can then get the activities you don't want to null e.g.
SOURCE ( "Activities"."Activity" , REMAP_VALUES ( "Activities"."Activity" , ; 'B' , null ] ) )
It is also possible with using ACTIVITY_LAG and ACTIVITY_LEAD and then calculating the time difference.
So many calculations possible .
Hope it helps.
In Celonis Help - Search for Ping pong cases. It might answer your query.