Create a activity and select Retrive, give it a naar and a xpath for the attribute you want.
Then create a activety and select argument list, choose count and then insert the name of your retriver.
Are you retrieving a list of objects? If so, there is a Aggregate List option under Action Activity that you can add to the microflow after retrieving the list. Under Aggregate List, there is a count function.