static int lastElement ( int a [ ] , int n ) {
  int steps = 1 ;
  Vector < Integer > [ ] v = new Vector [ N ] ;
  for ( int i = 0 ;
  i < N ;
  i ++ ) v [ i ] = new Vector < Integer > ( ) ;
  if ( n == 1 ) return a [ 0 ] ;
  for ( int i = 0 ;
  i < n ;
  i += 2 ) v [ steps ] . add ( a [ i ] | a [ i + 1 ] ) ;
  while ( v [ steps ] . size ( ) > 1 ) {
    steps += 1 ;
    for ( int i = 0 ;
    i < v [ steps - 1 ] . size ( ) ;
    i += 2 ) {
      if ( steps % 2 == 1 ) v [ steps ] . add ( v [ steps - 1 ] . get ( i ) | v [ steps - 1 ] . get ( i + 1 ) ) ;
      else v [ steps ] . add ( v [ steps - 1 ] . get ( i ) ^ v [ steps - 1 ] . get ( i + 1 ) ) ;
    }
  }
  return v [ steps ] . get ( 0 ) ;
}

static int lastElement ( int a [ ] , int n ) { int steps = 1 ; Vector < Integer > [ ] v = new Vector [ N ] ; for ( int i = 0 ; i < N ; i ++ ) v [ i ] = new Vector < Integer > ( ) ; if ( n == 1 ) return a [ 0 ] ; for ( int i = 0 ; i < n ; i += 2 ) v [ steps ] . add ( a [ i ] | a [ i + 1 ] ) ; while ( v [ steps ] . size ( ) > 1 ) { steps += 1 ; for ( int i = 0 ; i < v [ steps - 1 ] . size ( ) ; i += 2 ) { if ( steps % 2 == 1 ) v [ steps ] . add ( v [ steps - 1 ] . get ( i ) | v [ steps - 1 ] . get ( i + 1 ) ) ; else v [ steps ] . add ( v [ steps - 1 ] . get ( i ) ^ v [ steps - 1 ] . get ( i + 1 ) ) ; } } return v [ steps ] . get ( 0 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (generic_type (type_identifier) (type_arguments (type_identifier))) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) 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 (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (array_access array: (identifier) index: (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: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (expression_statement (method_invocation object: (array_access array: (identifier) index: (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)))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) 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: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list))) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) alternative: (expression_statement (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))))) (return_statement (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))