Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
Head of State elections were held in Costa Rica on 11 April 1847, shortly after a coup d'état that overthrew the first head of state elected in direct elections; Francisco María Oreamuno Bonilla who was formally overthrown although he had previously left office without resigning. The de facto president was José María Alfaro Zamora who was a candidate but was defeated by José María Castro Madriz.
These elections were held in two grades, first paid by all men over 20 or 18 if they were married or were teachers of some science, who chose the electors (168 in total) who voted to choose the positions in dispute. Also the electoral legislation established that, in five years, those who could not read or write won't be able to vote.