At a certain school, there are 6 subjects offered, and a student can take any combination of them. It is noticed that for any two subjects, there are fewer than 5 students taking both of them and fewer than 5 students taking neither. Determine the maximum possible number of students at the school.
Let us count in two ways the number of ordered pairs $\left(s,\left\{c_{1}, c_{2}\right\}\right)$, where $s$ is a student, $\left\{c_{1}, c_{2}\right\}$ is an unordered pair of two distinct courses, and $s$ is either taking both $c_{1}$ and $c_{2}$ or neither $c_{1}$ nor $c_{2}$.

First, we consider any of the $\left(\begin{array}{l}6 \\ 2\end{array}\right)=15$ pairs $\left\{c_{1}, c_{2}\right\}$ of distinct courses. By the given conditions, at most 4 students are taking neither $c_{1}$ nor $c_{2}$ and at most 4 take both, implying that $\left\{c_{1}, c_{2}\right\}$ gives rise to at most 8 pairs $\left(s,\left\{c_{1}, c_{2}\right\}\right)$, so the total number of such pairs is at most 120 .

Second, let $N$ be the number of students. Consider any student $s$. If $k$ denotes the number of courses $s$ is taking, then the number of pairs of courses $\left\{c_{1}, c_{2}\right\}$ such that $s$ is taking both or neither of them is

$$
\left(\begin{array}{l}
k \\
2
\end{array}\right)+\left(\begin{array}{c}
6-k \\
2
\end{array}\right)
$$

Plugging in $k=0,1, \ldots, 6$ shows that the minimum value of this expression is 6 , attained at $k=3$. Thus there are at least $6 \mathrm{~N}$ pairs $\left(s,\left\{c_{1}, c_{2}\right\}\right)$.

Putting this together, we see that $6 N \leq 120$, so $N$ is at most 20 . A total of 20 students indeed possible, as can be seen by letting each student take a distinct triplet of courses from the $\left(\begin{array}{l}6 \\ 3\end{array}\right)=20$ possible triplets.