How can it be that count(distinct x, y) < # records distinct x, y
You have 5 records with m.sex is null I think. 

Any operator applied to NULL (except IS [NOT] NULL and &lt;=&gt;) returns NULL treated as False.