stores the frequency of each element
count = defaultdict ( int ) NEW_LINE if ( n < 4 ) : NEW_LINE INDENT return 0 NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT count [ arr [ i ] ] += 1 NEW_LINE DEDENT