static int countEleLessThanOrEqual ( int arr [ ] , int n , int x ) {
  int min_index = findMinIndex ( arr , 0 , n - 1 ) ;
  if ( x <= arr [ n - 1 ] ) return ( binary_search ( arr , min_index , n - 1 , x ) + 1 - min_index ) ;
  if ( ( min_index - 1 ) >= 0 && x <= arr [ min_index - 1 ] ) return ( n - min_index + binary_search ( arr , 0 , min_index - 1 , x ) + 1 ) ;
  return n ;
}

static int countEleLessThanOrEqual ( int arr [ ] , int n , int x ) { int min_index = findMinIndex ( arr , 0 , n - 1 ) ; if ( x <= arr [ n - 1 ] ) return ( binary_search ( arr , min_index , n - 1 , x ) + 1 - min_index ) ; if ( ( min_index - 1 ) >= 0 && x <= arr [ min_index - 1 ] ) return ( n - min_index + binary_search ( arr , 0 , min_index - 1 , x ) + 1 ) ; return n ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (return_statement (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))) right: (decimal_integer_literal)) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (return_statement (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier)))) right: (decimal_integer_literal))))) (return_statement (identifier))))