This is the molecular orbital energy diagram of oxygen. Oxygen is in group 6 of the periodic table and therefore have 6 valence electrons. We are only showing the valence electrons since they are the electrons that participate in bonding.
Two oxygen with 6 electrons each gives us 12 electrons to be placed in the molecular orbitals. We often show 24 electrons, 12 in the atomic orbitals and 12 in the molecular orbitals. However there is just 12 electrons. Before bonding they are in the atomic orbitals and then after bonding they are in the molecular orbitals.