“I don’t know what else the White House could have done about it,” said Marc Short, Trump’s former legislative affairs director. “You have a record number of retirements in the House. We knew that months ago.”

Midterm elections are not necessarily an indicator of how a president will fare in a bid for a second term — President Barack Obama was dealt major losses in his first midterms in 2010 and then handily won reelection two years later.

Trump has shown no inclination that he’ll moderate his tactics ahead of 2020. Instead, he’ll probably be emboldened by a Democratic House, filled with members who will be hungry to investigate his administration and possibly launch impeachment proceedings against him, advisers said.

The president has started talking about how he would battle a potential Speaker Nancy Pelosi (D-Calif.), who was on track to lead House Democrats after losing the speaker’s gavel eight years ago. While his advisers have grown worried that he is not prepared for the onslaught of investigations, he has taken some pleasure in saying he will have a foil in House Democrats. At the same time, advisers said Trump might be open to dealing with the opposition party on certain issues and will probably welcome meetings with Pelosi more than some of his aides would like.

Pelosi’s spokesman said Trump called Pelosi on Tuesday night and acknowledged her call for “bipartisanship” in a speech to Democratic supporters.

Many Republicans are eager to continue to promote Pelosi as a political nemesis.

“There’s no question she was one of the biggest villains in the election for Republicans,” said Scott Jennings, a former adviser to Senate Majority Leader Mitch McConnell (R-Ky.) who also worked in the George W. Bush White House. “So if she’s in charge, she’s already at a place in her own image where Trump can turn her into a great foil for the next two years, and the American people would probably appreciate it very much if he worked with Mitch McConnell to stop some of her worst impulses.”

Trump has taken several lessons from the midterm elections, according to his advisers, including that Congress is not as popular as he is and that immigration continues to rile up his base.

Trump gets regular briefings on what his numbers are in key districts and compares them with congressional candidates and what his numbers were in 2016. In private conversations with allies, he has shown no willingness to tone it down — instead talking about how he can ramp up his rhetoric and complaining that other Republicans are not following his lead.

“Are we going to win Pennsylvania?” he asked advisers recently on Air Force One as they traveled to the state that was key to shattering the Democrats’ “blue wall” in 2016.

In some ways, the president’s 2020 operation is more organized than other parts of his White House. Trump brought on Brad Parscale, who served as his digital media director on his 2016 campaign, in March, and a host of White House aides — including Justin Clark, the head of the Office of Public Liaison — are expected to transition to the campaign in the coming months.

Meanwhile, Trump’s campaign and affiliated committees have raised more than $106 million, stashing away a massive sum and at an earlier time than his predecessors at this point in their presidencies.

At the White House on Tuesday evening, Trump assembled a crew of top-tier donors and political allies to watch the election returns — including billionaire casino mogul Sheldon Adelson, financier Stephen Schwarzman and real estate magnate Richard LeFrak — after spending the day on the phone and monitoring key congressional and gubernatorial races nationwide.

Corey Lewandowski, his first campaign manager, and David Bossie, a former deputy campaign manager, were also there, as were Treasury Secretary Steven Mnuchin, White House Chief of Staff John F. Kelly, political director Bill Stepien and senior aide Johnny DeStefano.

“The president has energized a staggering number of Americans at packed arenas and in overflow crowds at rallies across the country,” Sanders said as the polls began to close Tuesday night.