Question
Maximum Index Difference with Increasing Values

You are given an array a of size KaTeX can only parse string typed expression consisting of integers. Your task is to find the maximum difference between two indices KaTeX can only parse string typed expression and KaTeX can only parse string typed expression such that KaTeX can only parse string typed expression and KaTeX can only parse string typed expression.

The difference is defined as KaTeX can only parse string typed expression.

If no such pair exists, print KaTeX can only parse string typed expression.

Input
The first line contains a single integer KaTeX can only parse string typed expression — the size of the array.
The second line contains KaTeX can only parse string typed expression integers — KaTeX can only parse string typed expression.
Output
Print a single integer — the maximum value of KaTeX can only parse string typed expression such that KaTeX can only parse string typed expression and KaTeX can only parse string typed expression.
Example
Input
6
3 5 4 2 6 1
Output
4
Explanation
The maximum difference is obtained for:
KaTeX can only parse string typed expression, KaTeX can only parse string typed expressionKaTeX can only parse string typed expression, KaTeX can only parse string typed expression
Since KaTeX can only parse string typed expression and KaTeX can only parse string typed expression, this is the maximum possible difference.

Online