private static Consumer < List < String >> solve ( ) {
  return args -> {
    final List < Integer > numList = Arrays . stream ( args . get ( 1 ) . split ( " " ) ) . map ( Integer :: valueOf ) . collect ( toList ( ) ) ;
    final List < Integer > matchedIndexList = IntStream . range ( 0 , numList . size ( ) ) . filter ( x -> numList . get ( x ) . equals ( x + 1 ) ) . boxed ( ) . collect ( toList ( ) ) ;
    Integer curr = - 1 ;
    Integer cnt = 0 ;
    Integer ans = 0 ;
    for ( final Integer index : matchedIndexList ) {
      if ( curr == - 1 || curr + 1 == index ) {
        cnt ++ ;
        curr = index ;
        continue ;
      }
      ans += Double . valueOf ( Math . ceil ( cnt . doubleValue ( ) / 2 ) ) . intValue ( ) ;
      cnt = 1 ;
      curr = index ;
    }
    ans += Double . valueOf ( Math . ceil ( cnt . doubleValue ( ) / 2 ) ) . intValue ( ) ;
    System . out . println ( ans ) ;
  };
}

private static Consumer < List < String > > solve ( ) { return args -> { final List < Integer > numList = Arrays . stream ( args . get ( 1 ) . split ( " ▁ " ) ) . map ( Integer :: valueOf ) . collect ( toList ( ) ) ; final List < Integer > matchedIndexList = IntStream . range ( 0 , numList . size ( ) ) . filter ( x -> numList . get ( x ) . equals ( x + 1 ) ) . boxed ( ) . collect ( toList ( ) ) ; Integer curr = - 1 ; Integer cnt = 0 ; Integer ans = 0 ; for ( final Integer index : matchedIndexList ) { if ( curr == - 1 || curr + 1 == index ) { cnt ++ ; curr = index ; continue ; } ans += Double . valueOf ( Math . ceil ( cnt . doubleValue ( ) / 2 ) ) . intValue ( ) ; cnt = 1 ; curr = index ; } ans += Double . valueOf ( Math . ceil ( cnt . doubleValue ( ) / 2 ) ) . intValue ( ) ; System . out . println ( ans ) ; } ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (generic_type (type_identifier) (type_arguments (type_identifier))))) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (lambda_expression parameters: (identifier) body: (block (local_variable_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) name: (identifier) arguments: (argument_list (string_literal))))) name: (identifier) arguments: (argument_list (method_reference (identifier) (identifier)))) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list)))))) (local_variable_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement (modifiers) type: (type_identifier) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (continue_statement))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))))