implemented the count transformation