Do the count in a functional style