Lincoln Elementary has 651 students and 31 teachers. The total number of students in the elementary and middle school is 1,197. How many teachers does the middle school have if it has the same teacher-student ratio as the elementary school?