Solution (source code)

= Solution

The answer is $\Theta(n^2)$. All four-sets containing one fixed pair form a family of size
$$
\binom{n-2}{2}=\Theta(n^2)
$$
whose distinct intersections have size two or three. The <Ray-Chaudhuri–Wilson theorem> for the two allowed intersection sizes gives the matching $O(n^2)$ upper bound.