Function to find the maximum count of subarrays
static long subarray ( List < Integer > v ) { int n = v . size ( ) ; if ( n <= 1 ) return n ; long ans = proc ( v ) ; int low = v . get ( 0 ) , pos_low = 0 ; int high = v . get ( 0 ) , pos_high = 0 ;