Anti-corruption protesters sing the Brazilian national anthem along Copacabana beach on December 4. (Mario Tama/Getty Images)

Chris Feliciano Arnold is the author of “The Third Bank of the River: Blood, Power and Survival in the Twenty-First Century Amazon,” forthcoming from Picador USA. Follow him @chrisarnold.

During the first half of 2016, as Brazil staggered through a corruption investigation, a painful recession and the impeachment of then-President Dilma Rousseff, observers in the United States were quick to lecture their South American neighbor on the fundamentals of democracy and free markets. Now at the end of a tumultuous year in both Americas, it’s clear that the United States has its own painful lessons to learn.

Some historians and analysts are tempted to cast Brazil as a wild little sibling, toddling in the shadow of the mature United States. That was a tidy narrative as Brazil emerged from the grip of military dictatorship in the 1980s and 1990s, rose to the global stage during the commodities boom of the 2000s, then imploded under the weight of a commodities bust, compounded by a corruption scandal that ensnared corporations, magnates and politicians across the country.

The pompous attitude of the United States toward Brazil was dramatized during this year’s Olympic Games in Rio de Janeiro when pundits almost took a gleeful inventory of the host city’s shortcomings: violent crime, oppressive security, toxic water. Never mind that murder rates were surging in Chicago (the U.S. candidate for the 2016 Games), that our National Guard had recently been deployed against protesters in Ferguson, Mo., or that children in Flint, Mich., had dangerous levels of lead in their water. When gold medal winning swimmer Ryan Lochte was exposed as a liar and vandal after a night of drunken partying, his conduct captured a certain U.S. attitude toward Brazil as a picturesque banana republic where Americans are free to urinate wherever they please.

Then came the second half of 2016. Summer became winter, winter became summer. In the changed hemispheric light, the United States and Brazil almost looked like fraternal twins, sprouting awkwardly from the legacies of genocide and slavery, warped by greed and inequality.

In Brazil and the United States in 2016, right-wing politicians channeled economic frustration to seize power from pioneering female leaders. When Rouseff, a former radical leftist who endured three years of torture at the hands of the dictatorship, was removed from office, right-wing deputy Eduardo Bolsonaro cast his impeachment vote “for the military men of ’64.” When Hillary Clinton faced off against Donald Trump in the debates, she was dismissed as a “nasty woman” and threatened with jail by a billionaire who was being sued for housing discrimination while she was working for the Children’s Defense Fund.

Speaking of deals, in Brazil and the United States in 2016, free-market capitalism came at a steep cost. Investigators in Brazil discovered an epic graft scandal at the national oil company Petrolio Brasileiro, as political appointees were systematically overcharging contractors and using the spoils for party funding and bribes. Meanwhile, less than a month into the president-elect’s transition, Trump’s company removed its name from a luxury hotel in Rio after the project was being investigated by Brazilian federal authorities for “possibly criminal” investments by state agencies — is striking deals with individual companies, threatening other companies on Twitter and stocking his Cabinet with top donors and the chief of the world’s energy company.

While we’re on the subject of energy,  public-private consortia in Brazil  and the United States faced fierce protest from indigenous groups in response to infrastructure projects deemed critical to meeting energy demand.  In Brazil’s Pará state, indigenous groups continued to protest the monumental Belo Monte hydroelectric dam project that has flooded their ancestral territory and displaced thousands of families. In Standing Rock, indigenous demonstrators braved blizzards and water cannons to protect their land from encroachment and environmental degradation.

As for demonstrations, in Brazil and the United States in 2016, movements swelled against militarized police who are killing black men at alarming rates, evidence of  the institutional racism that persists from the era of slavery. Police in both countries are shielded by a legal process that allows police astonishing leeway in the use of force despite increased media coverage of the shootings.

Oh, the media. In Brazil and the United States in 2016, democracy wobbled under the influence of media conglomerates pushing infotainment. Brazil’s Globo Network, Latin America’s largest media company and former collaborator of the military regime, gave extraordinary airtime to the corruption scandal, broadcasting the twists and turns as if covering a soap opera. Meanwhile, in the United States, the largest media companies brewed a toxic cocktail of celebrity and politics, inadvertently advancing a Russian disinformation campaign by giving billions of dollars of free airtime to self-described “ratings machine” Donald Trump.

Don’t get me started on new administrations. It’s been decades since the United States backed the 1964 military coup in Brazil, but in 2016, it turns out that the United States, too, is vulnerable to foreign meddling.

To be clear, these are not perfect parallels, but as two of the largest and most diverse democracies in the world, the United States and Brazil are worth examining side by side. As the United States enters a new era led by a man who has pledged to put America first, its leaders might reconsider the notion that the nation is so exceptional that it is impervious to the ripples of its bloody history and that it has nothing to learn from its neighbors.

Some in Washington believe globalism is a threat to U.S. sovereignty, yet to turn inward is to overlook the challenges it shares — and can solve together — with the other large democracy in the hemisphere, a country that, like America, is beautiful and horrifying, bountiful and haunted, eager to lead in this young century.