Majority logic gate
The circuit is called "Majority Logic Gate." It has an odd number of input terminals (three in this project), and judges the input level (1 or 0) of each terminal. Then it judges which of the two kinds of inputs, 1 or 0, are larger in number. Why odd number inputs?
Because when you set even number of terminals, there can be a case of a tie. This circuit is made up of seven NAND gates.
See in figure 1: the output is 1 when two or more inputs are at 1, and is 0 when two or more inputs are at 0.
When you finish the wiring for the project, try pressing and releasing for various key combinations while looking at Figure 1, and see how this counter works. A table like this is called "Truth table". It shows the output logic levels against the combinations of the input levels.