An array of integers can be transformed into a new array through this process:
- is modified to be the maximum of and for all .
An array is stable if it remains the same after the above transformation is performed on the array. For example, is a stable array.
It can be proven that array , after a certain number of transformations, will result in a stable array. Can you print out the minimum number of transformations on array to transform it into a stable array?
The first line will contain the integer .
The second line will contain the array .
Output the number of minimum transformations to transform into a stable array.
5 1 3 2 4 5