Count array elements are greater than XOR
for i in range ( len ( arr ) ) : NEW_LINE INDENT if ( arr [ i ] > xorVal ) : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT DEDENT if ( cnt >= K ) : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT return NEW_LINE