On the last day of school, Ms. Quigg, the teacher, gave jellybeans to her class. She gave each boy as many jellybeans as there were boys in the class. She gave each girl as many jellybeans as there were girls in the class. She had bought 400 jellybeans. When she finished giving them out, she had 6 left; she ate these herself. How many students were in her class?