The majority function of a Boolean function, f(x,y,z) that takes the value 1 whenever a majority of variables (x,y,z) are 1. In the circuit diagram for the majority function shown below.
The logic gates for the boxes labeled p and q are respectively