public static void main ( String [ ] args ) {
  Scanner in = new Scanner ( System . in ) ;
  int n = in . nextInt ( ) ;
  String s = in . next ( ) ;
  char [ ] l = new char [ n ] ;
  char [ ] r = new char [ n ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    l [ i ] = s . charAt ( i ) ;
    r [ i ] = s . charAt ( 2 * n - 1 - i ) ;
  }
  char [ ] [ ] buf = new char [ 2 ] [ n ] ;
  long count = 0 ;
  for ( int i = 0 ;
  i < ( 1 << n ) ;
  i ++ ) {
    int [ ] p = new int [ 2 ] ;
    for ( int j = 0 ;
    j < n ;
    j ++ ) {
      int k = ( i >> j ) & 1 ;
      buf [ k ] [ p [ k ] ++ ] = l [ j ] ;
    }
    long [ ] [ ] dp = new long [ p [ 0 ] + 1 ] [ p [ 1 ] + 1 ] ;
    dp [ 0 ] [ 0 ] = 1 ;
    for ( int x = 0 ;
    x <= p [ 0 ] ;
    x ++ ) {
      for ( int y = 0 ;
      y <= p [ 1 ] ;
      y ++ ) {
        if ( x < p [ 0 ] && r [ x + y ] == buf [ 0 ] [ x ] ) {
          dp [ x + 1 ] [ y ] += dp [ x ] [ y ] ;
        }
        if ( y < p [ 1 ] && r [ x + y ] == buf [ 1 ] [ y ] ) {
          dp [ x ] [ y + 1 ] += dp [ x ] [ y ] ;
        }
      }
    }
    count += dp [ p [ 0 ] ] [ p [ 1 ] ] ;
  }
  System . out . println ( count ) ;
  in . close ( ) ;
}

public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = in . next ( ) ; char [ ] l = new char [ n ] ; char [ ] r = new char [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = s . charAt ( i ) ; r [ i ] = s . charAt ( 2 * n - 1 - i ) ; } char [ ] [ ] buf = new char [ 2 ] [ n ] ; long count = 0 ; for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { int [ ] p = new int [ 2 ] ; for ( int j = 0 ; j < n ; j ++ ) { int k = ( i >> j ) & 1 ; buf [ k ] [ p [ k ] ++ ] = l [ j ] ; } long [ ] [ ] dp = new long [ p [ 0 ] + 1 ] [ p [ 1 ] + 1 ] ; dp [ 0 ] [ 0 ] = 1 ; for ( int x = 0 ; x <= p [ 0 ] ; x ++ ) { for ( int y = 0 ; y <= p [ 1 ] ; y ++ ) { if ( x < p [ 0 ] && r [ x + y ] == buf [ 0 ] [ x ] ) { dp [ x + 1 ] [ y ] += dp [ x ] [ y ] ; } if ( y < p [ 1 ] && r [ x + y ] == buf [ 1 ] [ y ] ) { dp [ x ] [ y + 1 ] += dp [ x ] [ y ] ; } } } count += dp [ p [ 0 ] ] [ p [ 1 ] ] ; } System . out . println ( count ) ; in . close ( ) ; }
(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)))) (local_variable_declaration type: (type_identifier) 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 (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 (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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)) right: (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)) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))) update: (update_expression (identifier)) body: (block (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (update_expression (array_access array: (identifier) index: (identifier)))) right: (array_access array: (identifier) index: (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 (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) dimensions: (dimensions_expr (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (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: (array_access array: (identifier) index: (decimal_integer_literal))) 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: (array_access array: (identifier) index: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (array_access array: (identifier) index: (decimal_integer_literal))) index: (array_access array: (identifier) index: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))