public static void solve ( ) {
  int n = scan . nextInt ( ) ;
  int [ ] a = scan . readArray ( n ) ;
  int [ ] last = new int [ 1010 ] ;
  int cnt = 0 ;
  sort ( a ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    for ( int j = 0 ;
    j <= 1000 ;
    j ++ ) {
      if ( a [ i ] > last [ j ] ) {
        if ( last [ j ] > 0 ) {
          cnt ++ ;
        }
        last [ j ] = a [ i ] ;
        break ;
      }
    }
  };
}

public static void solve ( ) { int n = scan . nextInt ( ) ; int [ ] a = scan . readArray ( n ) ; int [ ] last = new int [ 1010 ] ; int cnt = 0 ; sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= 1000 ; j ++ ) { if ( a [ i ] > last [ j ] ) { if ( last [ j ] > 0 ) { cnt ++ ; } last [ j ] = a [ i ] ; break ; } } } ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (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: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (break_statement)))))))))