Workign grove count function