Count and Count(Query) implementation