Males and females both count toward the flock threshold. Twenty males and twenty females make forty, subject to the other legal conditions.
Counting both sexes for liability does not eliminate separate legal requirements for the age, kind and suitability of the animal handed over in payment.