

The first line of input contains an integer N denoting the length of the array.
The second line of input contains N integers denoting the elements of the array 'ARR'.
The output prints a single line containing an integer denoting the maximum distance.
You do not need to print anything, it has already been taken care of. Just implement the given function.
0 <= N <= 10^6
-10^9 <= ARR[i] <= 10^9
Time Limit: 1sec
In the brute force approach, to consider all pairs we will use two nested loops. The outer loop is used to select one element for the pair and the inner loop will select another element. Now if both the elements are equal we will update the maximum distance with the distance between them if the distance between both is greater than the maximum distance.