Da’n refers to sheep; a male may be called kabsh (ram), and a female na‘jah (ewe).
Ma‘z refers to goats; the male is called tays, and the female ‘anz. Males and females of both kinds count toward the livestock total.
Ghanam is the overarching fiqhi category, so sheep and goats are not assigned two distinct numerical thresholds.