If all three elements are same ( minimum element appears at l east 3 times ) . Answer is nC3 .
if arr [ 0 ] == arr [ 2 ] : NEW_LINE INDENT return ( count - 2 ) * ( count - 1 ) * ( count ) / 6 NEW_LINE DEDENT