Endomorphism structure of groups of order 2