Back on topic, simple math means that if you want the max number of combos with the least people, you need exactly the same number of men and women. This allows for the max number of couples.
For example, if you have only 6 people:
0 men / 6 women: ZERO possible combinations.
1 men / 5 women: FIVE possible combinations.
2 men / 4 women: EIGHT possible combinations.
3 men / 3 women: NINE possible combinations.
4 men / 2 women: EIGHT possible combinations.
5 men / 1 women: FIVE possible combinations.
6 men / 0 women: ZERO possible combinations.
It isn't quite that simple, since multiple children from any single pair of parents don't have identical DNA.
Well yeah, each person should also have at least one male and female child, but the more the merrier. So having nine couples having kids is the best situation.
If there are exactly even numbers of M/F, it's pretty easy to figure out how many people you need to start off with in order to get through however many generations with no one being forced to marry a cousin.
So, if you start with even numbers and each couple has at least one male & female child...
...Starting with 2 people: people in the 2nd generation have to mate with their sibling. Ouch.
...Starting with 4 people: people in the 3rd generation have to mate with their 1st cousin.
...Starting with 8 people: people in the 4th generation have to mate with their 2nd cousin.
...Starting with 16 people: people in the 5th generation have to mate with their 3rd cousin.
...Starting with 32 people: people in the 6th generation have to mate with their 4th cousin.
...Starting with 64 people: people in the 7th generation have to mate with their 5th cousin.
...Starting with 128 people: people in the 8th generation have to mate with their 6th cousin.
...Starting with 256 people: people in the 9th generation have to mate with their 7th cousin.
...and so on. This assumes every male mates with every female that is not related to him at all up until the generation that has no choice but to go for the cousin, and they each have at least 1M/1F for kids. How good this all works out heavily depends on the original generation. If you don't have exactly even numbers, the number of generations that can go without mating with a cousin goes way down. If you have 1 man and 255 women, the first generation has to mate with half-brothers/sisters.