This is tiny logical demonstration to count the number of docking ships by irregular use of full-adder. This will achieve a good response in the counting, but not good scalability.
About inner structure, see the below image.
About full-adder, you should read this wikipedia article (...