public static void solver ( int N , int [ ] a ) {
  int [ ] ans = new int [ N ] ;
  for ( int n = N - 1 ;
  n >= 0 ;
  n -- ) {
    if ( n == N - 1 ) {
      continue ;
    }
    else if ( n == N - 2 ) {
      ans [ n ] = Math . abs ( a [ n ] - a [ n + 1 ] ) ;
    }
    else if ( n == N - 3 ) {
      ans [ n ] = Math . abs ( a [ n ] - a [ n + 2 ] ) ;
    }
    else {
      ans [ n ] = Math . min ( Math . abs ( ans [ n + 1 ] + Math . abs ( a [ n ] - a [ n + 1 ] ) ) , Math . abs ( ans [ n + 2 ] + Math . abs ( a [ n ] - a [ n + 2 ] ) ) ) ;
    }
  }
  out . println ( ans [ 0 ] ) ;
}

public static void solver ( int N , int [ ] a ) { int [ ] ans = new int [ N ] ; for ( int n = N - 1 ; n >= 0 ; n -- ) { if ( n == N - 1 ) { continue ; } else if ( n == N - 2 ) { ans [ n ] = Math . abs ( a [ n ] - a [ n + 1 ] ) ; } else if ( n == N - 3 ) { ans [ n ] = Math . abs ( a [ n ] - a [ n + 2 ] ) ; } else { ans [ n ] = Math . min ( Math . abs ( ans [ n + 1 ] + Math . abs ( a [ n ] - a [ n + 1 ] ) ) , Math . abs ( ans [ n + 2 ] + Math . abs ( a [ n ] - a [ n + 2 ] ) ) ) ; } } out . println ( ans [ 0 ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (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 (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (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: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (continue_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))))