my ($points, %count); ++$count{$_} for @c; $points += $_ * ($_ - 1) for values %count;