GetFlagCount node or something like that?

I have made a simple plugin for something like what you are looking for(not only for booleans)

Just connect a count-(value) to the output