In 1824, John Quincy Adams was elected president by:

the popular vote
the House of Representatives
the electoral vote

the House of Representatives