They had to write their names and the name of the person they were voting for on their ballot paper.
Everyone voted, and no votes were invalid.
Candidate A received five votes and candidate B received four votes.
How many people did not have their names written on the ballot paper?
Check the voting rules again.
You don't need to concern yourself with who won the vote.
Look again at what has to be written on the ballot paper.
There are two things that have to be written on the ballot paper: the name of the person voting and the name of the person they are voting for.
The answer is '0'.