Implement logical count expressions.