static long solve ( long [ ] array ) {
  int n = array . length ;
  long result = 0 ;
  long tmpXor = array [ 0 ] ;
  long tmpSum = array [ 0 ] ;
  int left = 0 ;
  int right = 0 ;
  int count [ ] = new int [ n ] ;
  while ( left < n ) {
    if ( right < n - 1 && ( long ) ( tmpXor ^ array [ right + 1 ] ) == tmpSum + array [ right + 1 ] ) {
      tmpXor ^= array [ right + 1 ] ;
      tmpSum += array [ right + 1 ] ;
      right ++ ;
    }
    else {
      count [ left ] = right - left + 1 ;
      tmpSum -= array [ left ] ;
      tmpXor = tmpSum ;
      if ( left < n - 1 && left == right ) {
        right = left + 1 ;
        tmpXor = array [ left + 1 ] ;
        tmpSum = array [ left + 1 ] ;
      }
      left ++ ;
    }
  }
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    result += count [ i ] ;
  }
  return result ;
}

static long solve ( long [ ] array ) { int n = array . length ; long result = 0 ; long tmpXor = array [ 0 ] ; long tmpSum = array [ 0 ] ; int left = 0 ; int right = 0 ; int count [ ] = new int [ n ] ; while ( left < n ) { if ( right < n - 1 && ( long ) ( tmpXor ^ array [ right + 1 ] ) == tmpSum + array [ right + 1 ] ) { tmpXor ^= array [ right + 1 ] ; tmpSum += array [ right + 1 ] ; right ++ ; } else { count [ left ] = right - left + 1 ; tmpSum -= array [ left ] ; tmpXor = tmpSum ; if ( left < n - 1 && left == right ) { right = left + 1 ; tmpXor = array [ left + 1 ] ; tmpSum = array [ left + 1 ] ; } left ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { result += count [ i ] ; } return result ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (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: (array_access array: (identifier) index: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (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))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (update_expression (identifier)))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (update_expression (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: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (return_statement (identifier))))