public static void main ( String [ ] args ) throws Exception {
  in = new StreamTokenizer ( new BufferedReader ( new FileReader ( new File ( NAME + ".in" ) ) ) ) ;
  out = new PrintWriter ( new File ( NAME + ".out" ) ) ;
  int tests = next ( ) ;
  for ( int test = 1 ;
  test <= tests ;
  test ++ ) {
    int n = next ( ) ;
    if ( n == 0 ) {
      out . println ( "Case #" + test + ": 0" ) ;
      continue ;
    }
    int m = 10005 ;
    int [ ] k = new int [ m ] ;
    for ( int i = 0 ;
    i < n ;
    i ++ ) k [ next ( ) ] ++ ;
    int answ = 100000 ;
    int start = 0 ;
    int end = 0 ;
    while ( true ) {
      while ( start < m && k [ start ] == 0 ) start ++ ;
      if ( start == m ) break ;
      end = start ;
      while ( k [ end ] != 0 ) end ++ ;
      ArrayList < Integer > s = new ArrayList < Integer > ( ) ;
      ArrayList < Integer > e = new ArrayList < Integer > ( ) ;
      for ( int i = start ;
      i <= end ;
      i ++ ) {
        if ( k [ i ] > k [ i - 1 ] ) for ( int j = 0 ;
        j < k [ i ] - k [ i - 1 ] ;
        j ++ ) s . add ( i ) ;
        if ( k [ i ] < k [ i - 1 ] ) for ( int j = 0 ;
        j < k [ i - 1 ] - k [ i ] ;
        j ++ ) e . add ( i ) ;
      }
      for ( int i = 0 ;
      i < s . size ( ) ;
      i ++ ) answ = Math . min ( answ , e . get ( i ) - s . get ( i ) ) ;
      start = end ;
    }
    out . println ( "Case #" + test + ": " + answ ) ;
  }
  out . close ( ) ;
}

public static void main ( String [ ] args ) throws Exception { in = new StreamTokenizer ( new BufferedReader ( new FileReader ( new File ( NAME + " . in " ) ) ) ) ; out = new PrintWriter ( new File ( NAME + " . out " ) ) ; int tests = next ( ) ; for ( int test = 1 ; test <= tests ; test ++ ) { int n = next ( ) ; if ( n == 0 ) { out . println ( " Case ▁ # " + test + " : ▁ 0" ) ; continue ; } int m = 10005 ; int [ ] k = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) k [ next ( ) ] ++ ; int answ = 100000 ; int start = 0 ; int end = 0 ; while ( true ) { while ( start < m && k [ start ] == 0 ) start ++ ; if ( start == m ) break ; end = start ; while ( k [ end ] != 0 ) end ++ ; ArrayList < Integer > s = new ArrayList < Integer > ( ) ; ArrayList < Integer > e = new ArrayList < Integer > ( ) ; for ( int i = start ; i <= end ; i ++ ) { if ( k [ i ] > k [ i - 1 ] ) for ( int j = 0 ; j < k [ i ] - k [ i - 1 ] ; j ++ ) s . add ( i ) ; if ( k [ i ] < k [ i - 1 ] ) for ( int j = 0 ; j < k [ i - 1 ] - k [ i ] ; j ++ ) e . add ( i ) ; } for ( int i = 0 ; i < s . size ( ) ; i ++ ) answ = Math . min ( answ , e . get ( i ) - s . get ( i ) ) ; start = end ; } out . println ( " Case ▁ # " + test + " : ▁ " + answ ) ; } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))))))))) (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation 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 name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (continue_statement))) (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 (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: (expression_statement (update_expression (array_access array: (identifier) index: (method_invocation name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (true)) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) body: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) body: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) 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: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier)))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal)) right: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))