Naive implementation of cardinality.