The count function