Helper function to count the number of non-empty elements in a validated array.
Important: Only use it for validated arrays where validate_array(array) returns true,
which ensures that:
All elements before the first empty element are non-empty
All elements after and including the first empty element are empty
The array forms a contiguous sequence of non-empty elements followed by empty elements
Deprecated.
Helper function to count the number of non-empty elements in a validated array. Important: Only use it for validated arrays where validate_array(array) returns true, which ensures that: