Take x as the number of middle school students. According to the statement, the ratio of elementary students to middle school students is 2:1, which means that for every x middle school students there are 2x elementary students.
The sum of elementary and middle school students is 27. Which means that the sum of x and 2x is 27:
The number of elementary school students is 2x:
There are 18 elementary students on the bus 5.