static int findNumOfPaint ( ArrayList < Integer > arr ) {
  int n = arr . size ( ) ;
  int color = 0 ;
  while ( arr . isEmpty ( ) == false ) {
    int x = findMin ( arr ) ;
    color ++ ;
    for ( int i = 0 ;
    i < arr . size ( ) ;
    ) {
      if ( arr . get ( i ) % x == 0 ) {
        arr . remove ( i ) ;
      }
      else {
        i ++ ;
      }
    }
  }
  return color ;
}

static int findNumOfPaint ( ArrayList < Integer > arr ) { int n = arr . size ( ) ; int color = 0 ; while ( arr . isEmpty ( ) == false ) { int x = findMin ( arr ) ; color ++ ; for ( int i = 0 ; i < arr . size ( ) ; ) { if ( arr . get ( i ) % x == 0 ) { arr . remove ( i ) ; } else { i ++ ; } } } return color ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (false))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (update_expression (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (expression_statement (update_expression (identifier))))))))) (return_statement (identifier))))