So, here it is.
import Data.List cards = [(1,7),(0,5),(3,7),(2,7),(2,13)] countpairs  = 0 countpairs [a] = 0 countpairs (a:as) = length . filter (((snd a)==) . snd) $ as pairingOff = sum . map countpairs . tails
And that’s that. Alas, the actual competition only takes Perl, VBScript and PowerShell, so I won’t be submitting this.