Host Angola and Algeria drew 0-0 to both advance to the quarterfinals at the African Cup of Nations, knocking out Malawi and Mali in Group A. Angola topped the group with five points. Mali beat Malawi 3-1 to join Algeria on four points but the Algerians have a superior head-to-head record. Mali was last with three points. Algeria will play the top team in Group B and Angola the No. 2 team. Ivory Coast has already advanced from that group, with Ghana and Burkina Faso in contention for the other spot. In the northern province of Cabinda, Frederic Kanoute, Seydou Keita and Mamadou Bagayoko all scored for Mali with Russell Mwafulirwa pulling a goal back for Malawi. Kanoute took advantage of a poor clearance by goalkeeper Swadick Sanudi to score in the first minute. Two minutes later, it was 2-0 when Barcelona midfielder Keita scored his third goal in the competition with a free kick from 25 meters. Bagayoko scored Mali's third in the 85th minute to seal the result when he headed home from close range after connecting with substitute Modibo Maiga's cross. "This is really disappointing. They changed the rules this year and we are out despite finishing ahead of Algeria on goal difference," Bagayoko said. "It's a pity because we have a really talented bunch of players. We had the weapons to do something during this African Cup." Malawi had beaten World Cup qualifier Algeria 3-0 in its opening group game but then lost 2-0 to Angola. In Luanda, Angola looked slow and lethargic in the second half as it knew that a draw would be enough to advance. "We knew a draw would be enough, so we managed to get our result," Angola coach Manuel Jose said. "In the next round, we are ready to play any team." Algeria, however, could only go through if Malawi didn't win and almost made a horror start when defender Nadir Belhadj made an error in the six-yard box in the seventh minute but the Portsmouth defender quickly recovered to cut out Djalma's shot. "We can play any team," Algeria forward Hammer Bouzza said. "We know Ivory Coast has a lot of big players but we are not afraid. We have got enough days to rest. After that, we will be ready for anyone." Gilberto had hurt his elbow in the win over Malawi, missing most of the win, but was still selected in the Angolan team. He played a one-two with Manucho in the 15th before firing wide with a left-footed strike from 20 meters. Two minutes later, Angola's Mabina sent in a curling cross from the left that almost dropped in underneath the crossbar. Madjid Bougherra responded for Algeria, forcing a diving save from goalkeeper Carlos in the 21st after getting on the end of a free kick from Belhadj. Algeria goalkeeper Faouzi Chaouchi tipped Ze Kalanga's mid-range attempt over in the 25th, before stopping a shot from Manucho six minutes later. "We knew Mali was winning, so the match got a little bit slow," Bouzza said. "It wasn't intentional but we were only going for a win. Now that we have qualified, we are very proud of ourselves."