added an array count function