Pulse counting energymeter

good day
thank you in advance
it is necessary to count the pulses at a time
at a time can come and 0, 1, 2 different numbers
how do I implement this

Can you show us what you have tried so far, and what the result was.
What in particular are you having problems with?

good day
I don't even have any idea how to implement it and maybe implement it

there is some device that outputs pulses at a time of reading can be 0 pulses, 1, 4, 10 pulses

This might be useful. I found it by searching for sum on the flows site.