Tunisia and South Africa filled the final two places for the round of 16 after a tense finish to the group stage in Egypt.
The African Cup of Nations brings the likes of superstars such as Sadio Mane, Mohamed Salah, and Riyad Mahrez on to the same field as Madagascar's Jean Romario Baggio Rakotoarisoa, who plays in the country's ramshackle league, and Selemani Ndikumana, who lived through the long civil war, which ravaged Burundi until 2005.
The tournament began with what has become almost a traditional prelude: a team arguing over bonuses.
Cameroon initially refused to fly to Egypt and, even when they were eventually persuaded to travel, the players said they were still not satisfied with the offer. Pay disputes subsequently affected Nigeria, Zimbabwe, and Uganda.
Newcomers Madagascar provided romance as they beat Nigeria on the way to topping their group, a remarkable achievement for a motley collection of players from the lower leagues in France and clubs in Belgium, Bulgaria and the United States, and led by former French fourth-tier coach Nicolas Dupuis.
Uganda reached the knockout stage for the first time in 41 years and Benin, taking part at their fourth AFCON, made it past the group stage for the first time although they still have to win a match at the finals. They drew all their games.
The most impressive sides were the North African trio of Egypt, Morocco, and Algeria who all topped their groups with a 100 per cent record and without conceding any goals.
Algeria looked particularly strong although it was not pretty as they committed an average of 28 fouls a match, according to official statistics.