Gary Cohn is apparently the exception to Donald Trump's rule about working in the Oval Office.

President Trump boasted on Tuesday afternoon that "everybody wants to work in the White House" — just a couple hours before his key economic advisor announced he's leaving.

At a news conference at the White House, the president spoke at length about the "tremendous energy" that draws the "best talent" to his administration.

"They all want a piece of that Oval Office. They want a piece of the West Wing," he said. "And not only in terms of, it looks great on their resume — it's just a great place to work."

Cohn, a former Goldman Sachs president who worked as White House chief economic advisor, resigned shortly afterward.

Trump made his comments as part of an effort to push back against reports that the White House is in turmoil in the wake of a several high-profile departures.

The idea of Cohn's resignation was feared by markets, which had seen him as a stable, experienced presence and pro-trade voice within the White House.

U.S. stock futures pointed sharply lower after news of Cohn's imminent departure.