Return the maximum difference between frequencies of any two elements such that element with greater frequency is also greater in value .
def maxdiff ( arr , n ) : NEW_LINE INDENT freq = { } NEW_LINE dist = [ 0 ] * n NEW_LINE DEDENT