public static void main ( String [ ] args ) {
  Scanner in = new Scanner ( System . in ) ;
  int T = in . nextInt ( ) ;
  for ( int zz = 1 ;
  zz <= T ;
  zz ++ ) {
    int N = in . nextInt ( ) ;
    int [ ] MC = new int [ 10000 ] ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) {
      MC [ in . nextInt ( ) - 1 ] ++ ;
    }
    int ans = 0 ;
    int [ ] C = new int [ 10000 ] ;
    int [ ] E = new int [ 10000 ] ;
    for ( int i = 1 ;
    i <= N ;
    i ++ ) {
      boolean good = true ;
      for ( int j = 0 ;
      j < 10000 ;
      j ++ ) C [ j ] = MC [ j ] ;
      Arrays . fill ( E , 0 ) ;
      for ( int j = 0 ;
      j < 10000 ;
      j ++ ) {
        while ( C [ j ] > 0 ) {
          boolean legal = true ;
          if ( j + i > 10000 ) {
            legal = false ;
          }
          else {
            for ( int k = 0 ;
            k < i ;
            k ++ ) if ( C [ j + k ] == 0 ) legal = false ;
          }
          if ( legal ) {
            for ( int k = 0 ;
            k < i ;
            k ++ ) C [ j + k ] -- ;
            if ( j + i < 10000 ) E [ j + i ] ++ ;
          }
          else {
            if ( E [ j ] > 0 ) {
              E [ j ] -- ;
              C [ j ] -- ;
              if ( j + 1 < 10000 ) E [ j + 1 ] ++ ;
            }
            else {
              good = false ;
              break ;
            }
          }
        }
      }
      if ( good ) {
        ans = i ;
      }
    }
    System . out . format ( "Case #%d: %d\n" , zz , ans ) ;
  }
}

public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int zz = 1 ; zz <= T ; zz ++ ) { int N = in . nextInt ( ) ; int [ ] MC = new int [ 10000 ] ; for ( int i = 0 ; i < N ; i ++ ) { MC [ in . nextInt ( ) - 1 ] ++ ; } int ans = 0 ; int [ ] C = new int [ 10000 ] ; int [ ] E = new int [ 10000 ] ; for ( int i = 1 ; i <= N ; i ++ ) { boolean good = true ; for ( int j = 0 ; j < 10000 ; j ++ ) C [ j ] = MC [ j ] ; Arrays . fill ( E , 0 ) ; for ( int j = 0 ; j < 10000 ; j ++ ) { while ( C [ j ] > 0 ) { boolean legal = true ; if ( j + i > 10000 ) { legal = false ; } else { for ( int k = 0 ; k < i ; k ++ ) if ( C [ j + k ] == 0 ) legal = false ; } if ( legal ) { for ( int k = 0 ; k < i ; k ++ ) C [ j + k ] -- ; if ( j + i < 10000 ) E [ j + i ] ++ ; } else { if ( E [ j ] > 0 ) { E [ j ] -- ; C [ j ] -- ; if ( j + 1 < 10000 ) E [ j + 1 ] ++ ; } else { good = false ; break ; } } } } if ( good ) { ans = i ; } } System . out . format ( " Case ▁ # % d : ▁ % d \n " , zz , ans ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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 (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: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (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 (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (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))))) (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 (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) (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 (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false)))) alternative: (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: (identifier)) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (false))))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (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: (identifier)) update: (update_expression (identifier)) body: (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))))) alternative: (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 (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier))))))))