# [Perl 5] `-pl`, 31 bytes

<!-- language-all: lang-perl -->

    $k{$_}++}{$_=!grep$_-2,values%k

[Try it online!][TIO-lrzccuw5]

[Perl 5]: https://www.perl.org/
[TIO-lrzccuw5]: https://tio.run/##K0gtyjH9/18lu1olvlZbuxZI2SqmF6UWqMTrGumUJeaUpharZv//b8hlxGXMBSFNuUz/5ReUZObnFf/X9TXVMzA0@K9bkAMA "Perl 5 – Try It Online"