public static void taskSolver ( ) {
  int n = sc . nextInt ( ) ;
  int ans = 0 ;
  int arr [ ] = new int [ n + 1 ] ;
  int oddsuff = 0 ;
  int evensuff = 0 ;
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    arr [ i ] = sc . nextInt ( ) ;
    if ( i % 2 == 0 ) evensuff += arr [ i ] ;
    else oddsuff += arr [ i ] ;
  }
  int oddpref = 0 , evenpref = 0 ;
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    if ( i % 2 == 0 ) evensuff -= arr [ i ] ;
    else oddsuff -= arr [ i ] ;
    if ( oddpref + evensuff == evenpref + oddsuff ) ans ++ ;
    if ( i % 2 == 0 ) evenpref += arr [ i ] ;
    else oddpref += arr [ i ] ;
  }
  out . println ( ans ) ;
}

public static void taskSolver ( ) { int n = sc . nextInt ( ) ; int ans = 0 ; int arr [ ] = new int [ n + 1 ] ; int oddsuff = 0 ; int evensuff = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( i % 2 == 0 ) evensuff += arr [ i ] ; else oddsuff += arr [ i ] ; } int oddpref = 0 , evenpref = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) evensuff -= arr [ i ] ; else oddsuff -= arr [ i ] ; if ( oddpref + evensuff == evenpref + oddsuff ) ans ++ ; if ( i % 2 == 0 ) evenpref += arr [ i ] ; else oddpref += arr [ i ] ; } out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (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: (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 (binary_expression left: (identifier) right: (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))) (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) 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: (identifier)) update: (update_expression (identifier)) 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 (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))