count subarrays with all elements