Approach hintTry it first, then revealHide
Only the largest frequency f really matters: compare it with the number of other elements n - f. Simulating with a max-heap that removes one copy each of the two most frequent values gives the same answer.