Statistical thermodynamics of electrons and holes in semiconductors