The day after the school election it was reported that Danny won the election for class president. For every three votes his opponent received, Danny received 5 votes. Every student voted exactly once. If the students voted only for either Danny or his opponent and Danny's opponent received 312 votes, how many students voted in the election?