A look at how October 7 elections will work and who are the top presidential contenders.

Brazilians will head to the polls on October 7 for national and state-level elections, with more than 1,650 positions up for grabs, including the presidency.

More than 147 million people are eligible to vote. Participation is compulsory for “literate” Brazilians aged 18-70.

At stake are the country’s presidency, all 27 state governorships, most of the seats in Congress – including two-thirds of the 81-member upper-house Senate and all 513 places in the lower-house Chamber of Deputies – and 1,059 positions within state legislatures.

Two different electoral systems are used to decide the various posts: majority and proportional. All voting is done electronically using a single, number-based method. Participants will first decide on state legislators before voting on congressional positions, state governors and, finally, the presidency.

Presidential and state governor candidates must win an absolute majority of the vote to be elected. If no candidate is able to secure more than 50 percent of support in the first round, the two contenders with the highest number of votes will go head-to-head in a second ballot on October 28.

Senators, meanwhile, are elected by a simple majority and do not require more than 50 percent of support to win office.

Federal and state deputies – in the lower house Chamber of Deputies and state legislatures respectively – are elected via a proportional system.

Thirteen politicians are vying to become the country’s 38th president.

Far-right candidate Jair Bolsonaro leads the latest polls, with about 28 percent of the vote. Leftist candidate Fernando Haddad, who replaced the imprisoned yet widely popular former president Luiz Inacio “Lula” da Silva as the Workers’ Party candidate earlier this month, trailed in second place with about 22 percent of support.

A second-round vote on October 28 is likely, with all recent polling pointing towards no contender winning more than 50 percent support in the first-round poll.

The successful candidate will begin a four-year term on January 1, 2019.