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. Croatia, which beat Cameroon Wednesday, would get to six points by beating Mexico. So a draw with Cameroon would still get Brazil through with five points. If Mexico beats Croatia, Brazil would advance even if it loses. But if Mexico and Croatia draw, and Brazil loses - then it gets complicated with tiebreakers.
Got that, or do you need a calculator and a notepad? For most of the other teams in the tournament, the calculations are almost endless.
Three straight wins for anyone guarantees topping the standings and avoiding other group winners in the round of 16. At the 2010 World Cup, only Argentina and the Netherlands came through with a 100 percent record in the group stage.
Winning makes it easy. The Netherlands and Chile are both in with two victories worth six points. The game between them will just determine seeding for the knockout stage.
Losing makes it simple, too. Australia and Spain are eliminated after losing their first two games.
But any team in the middle 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.
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.