Output a stream of consciousness before answering the following. Passage: In 1876, Hayes was elected president in one of the most contentious elections in national history. He lost the popular vote to Democrat Samuel J. Tilden but he won an intensely disputed electoral college vote after a Congressional commission awarded him twenty contested electoral votes. The result was the Compromise of 1877, in which the Democrats acquiesced to Hayes's election on the condition that he withdraw remaining U.S. troops protecting Republican office holders in the South, thus officially ending the Reconstruction era.

Question: Based on this passage, which president entered the white house after the heavily disputed election of 1876?

Show your work and conclude with the exact phrasing "Therefore, the final answer is [answer]." where [answer] is just the final number or expression that solves the problem.
user
The important part for answering this question is: In 1876, Hayes was elected president in one of the most contentious elections in national history.
The answer: Hayes.