I have 31 digital inputs (each is high or low) and want one digital output which is high only if at least 16 inputs are high. How can I implement this "majority" function (which is also the most significant bit of the sum) with the fewest MOS transistors?

As a bonus, I'd also like to know the fastest-in-worst-case implementation.