sort {$b->{'count'} <=> $a->{'count'} || $b->{'type'} cmp $a->{'type'}} @data