We tend to think about two biological sexes: male and female. But before the evolution of eggs and sperm — before sex cells began to diverge in size and form — organisms couldn’t be classified by sex. The same holds true for many fungi, algae and protozoans today. Instead of sexes, these species have mating types, with sex cells that differ at the molecular level but not anatomically. And those mating types don’t necessarily come in pairs.

Take the social amoeba Dictyostelium discoideum, which has three: Each type can mate with members of the other two. Coprinellus disseminatus, a white-capped mushroom, has 143, each able to find a partner among the 142 others. The hairy, fan-shape fungus Schizophyllum commune boasts more than 23,000 mating types (though its more intricate reproductive strategy means that not every type can mate with every other).

Yet most species still have only two mating types. George Constable, a research fellow at the University of Bath, and Hanna Kokko, an evolutionary biologist at the University of Zurich, wanted to know why. In a paper published last month in Nature Ecology & Evolution, they developed a model that predicts how many mating types will emerge in a species based on just three fundamental ecological elements: the mutation rate (which introduces new types), the population size and — perhaps most surprisingly — the frequency of sex. Their work not only provides insights about the basic biology of these kinds of organisms, but could also contribute to our understanding of how the male and female sexes ultimately evolved.

Many scientists believe mating types evolved early in life’s history as a barrier against behaviors like inbreeding that might be harmful to a population or species. If an organism has sex with an incompatible mating type (including its own mating type), then the union generally produces no offspring.

That restriction aside, logic suggests that species should benefit from having as many mating types as possible. With two types, only half the population is eligible as a mate for any individual. With three, that rises to two-thirds — and so on as more mating types join the mix. Should a mutation lead to the appearance of a new type, it wouldn’t be stuck with the problem of finding a rare match for itself in the population; instead, it would be able to mate with everyone else, thereby producing offspring more quickly and growing its numbers.

“The intuitive expectation is that this should happen for larger and larger numbers of mating types, until you have thousands of them,” Constable said.

To date, the hypotheses about why the number of mating types only rarely soars to enormous heights revolve around considerations of stability. Maintaining just two types may be the better way to go: It allows for simpler, more efficient pheromone-signaling networks, and for an easier sorting system when it comes to passing on organelles from parent to offspring cells. But these theories don’t account for a slew of exceptions.

Then something occurred to Constable. “I realized that we’d been assuming that these species have sex all the time,” he said. That assumption made a huge difference in his predictions about how populations would evolve, because during periods without sex, mating type becomes a neutral trait: Chance events dictate the dominance of some types and the disappearance of many others.

According to the model, large populations that rely relatively more on sex to reproduce can sustain a greater number of mating types, while those having less sex cannot. Constable and Kokko wondered just how rare sexual reproduction would have to be to explain as few as two mating types. Very, very rare, as it turned out: just once every few thousand generations.