In a long classroom, N desks are arranged in a single row, with two students sitting at each desk. Students are cranky because they are about to have a Math class, and their professor is planning to examine them.
Each student has studied, but only up to a certain level. The old professor can tell by the looks on their faces just how much they have studied. Usually, the professor uses a different coloured pencil for each grade. Unfortunately, today he brought only one pencil.
The desks are numbered from 1 to N. In order to make the examination seem fair, he wants to choose two desks and question one student from each desk positioned between the two desks he has chosen (including the chosen desks). It is important that all examined students deserve the same grades, so he can write them down using his only pencil.
The professor wants to know the maximum number of students he can examine this way, as well as which grade the students will get.