Sum of Imbalance Numbers of All Subarrays
Sum the imbalance numbers over all subarrays, where imbalance counts adjacent sorted gaps larger than 1.
Sum the imbalance numbers over all subarrays, where imbalance counts adjacent sorted gaps larger than 1.