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 = defaultdict ( lambda : 0 ) NEW_LINE DEDENT