I actually made an algorithm to detect how many inputs there are in a block. I use it in my block encoder