The sizes of the freshmen class and the sophomore class are in the ratio $5:4$. The sizes of the sophomore class and the junior class are in the ratio $7:8$. The sizes of the junior class and the senior class are in the ratio $9:7$. If these four classes together have a total of $2158$ students, how many of the students are freshmen?

Let's think step by step and output the final answer within \boxed{}.
user