RIO DE JANEIRO (AP) — Every four years, the World Cup forces fans to remember their math lessons.
Working out what each team needs from its final match to finish in the top two of a group and advance to the knockout rounds takes some algebra knowledge and powers of prediction.
After Brazil and Mexico played to a scoreless draw on Tuesday, the calculation became clear: Both teams just need to draw in their next matches to advance with five points in Group A. The winner of Wednesday's Croatia and Cameroon match could possibly get to six points — but the most the loser of that game could earn would be three points. And if both Brazil and Mexico earn draws in their next match, the winner of Croatia-Cameroon can't earn more than four points.
Got that? Well, for most of the other 30 teams, the calculations are almost endless.
Three straight wins for anyone guarantees topping the four-team standings and avoiding another group winner in the last 16.
At the 2010 World Cup, only Argentina and the Netherlands came through with a 100 percent record in the group stage.
Any team that drops points risks falling into a tiebreaker to decide the qualifying positions.
In that scenario, goal difference is king.
Goal difference gets to the essence of football: Score more goals than you concede. So even in the last minutes of a 3-0 game, a late goal by either side in the World Cup could decide the fate of a national team.
The simple equation is deduct how many goals a team conceded overall from how many it scored, and — ideally — what's left is a positive number. It is effectively worth an extra point.
Think goal difference is tough to work out on the fly mid-match? Meet "goal average".
Up to the 1966 World Cup, FIFA used goal average — a team's total goals scored divided by goals conceded — to decide tiebreakers. Goal difference arrived in 1970.
Four years ago in South Africa, goal difference was decisive for two group winners — including the United States — who finished level on points with the runner-up.
After 90 minutes of its third match the Americans were third in the live standings. Landon Donovan's stoppage-time winner against Algeria lifted his team top above England and Slovenia.
Runners-up in two other 2010 groups advanced by virtue of better goal difference than the third-placed team.
Here, Spain's 5-1 rout by the Netherlands last week was not just embarrassing. It also put the defending champion in a hole to qualify from a group where Chile, its opponent on Wednesday, already has three points from beating Australia 3-1.
Chile starts against Spain under little pressure to win the game. Draw on Wednesday, and the South Americans could be eliminated next Monday only if it lost to the Dutch while Spain beats Australia, and the combined winning margin is seven goals.
Do you need a notepad and a calculator yet?
As Spain found in 1998, four points and a healthy plus-4 goal difference is not always enough.
Then, at the first World Cup under the current 32-team format, Spain had the best record of all third-placed teams in the past 16 years. Despite beating Bulgaria 6-1 in its final match, Spain finished below Nigeria and Paraguay.
Not since 1994 has a World Cup group finished in a three-way tie on six points (meaning three teams won two games and lost one). Then, it happened twice in a crazier than usual group stage. And back then, with only 24 teams, the best third-place teams also advanced.
That was the year Group E ended in a four-way tie with all teams on four points and zero goal difference each.
Mexico finished top having scored the most goals — the next tiebreaker after goal difference. Runner-up Ireland placed above Italy, though both scored two goals. Ireland had won the head-to-head match, which is the next tiebreak criterion. Norway went home, because it had scored just one goal.
The 1982 World Cup is another classic for tiebreakers.
Eventual champion Italy advanced without winning a match. It drew all three games, edging Cameroon on goals scored.
And there was the notorious West Germany-Austria agreement.
The final Group 2 standings show the Germans, Austrians and Algeria all won two matches, but the underdog North Africans went out on goal difference.
Playing one day after Algeria beat Chile 3-2, the European neighbors mutually agreed that a 10th-minute German goal suited both teams, advancing both. They played out the match without trying to score.
Because of that scandal, FIFA decided that final group matches must kick off simultaneously in future.
Two screens and a good head for arithmetic is all a World Cup fan needs at that point.