Dr. Monadnock’s Socks

 

Dr. Monadnock, the myopic but lovable Algebra teacher, got up so early each morning that he had to dress in the dark. Each day he would grab two socks at random from his sock drawer as he got ready for school. His exceptionally perceptive math students saw him on various days through the school year in matching pairs of black, gray, or blue socks, but also in mismatched pairs of these same three colors. After taking copious sock-color statistics, they concluded (quite correctly, as it turns out) that their teacher had exactly a 50% chance of wearing matching socks on any given day.

What is the smallest number of socks of each color that Dr. Monadnock must own to produce this probability?