public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  long A = sc . nextLong ( ) ;
  long B = sc . nextLong ( ) ;
  boolean AOdd = A % 2 == 1 ;
  boolean BOdd = B % 2 == 1 ;
  if ( A == B ) {
    System . out . println ( A ) ;
  }
  else if ( AOdd && BOdd ) {
    long diff = B - A ;
    long LSB = ( diff ) / 2 % 2 ;
    if ( LSB == 1 ) {
      System . out . println ( A - 1 ) ;
    }
    else {
      System . out . println ( A ) ;
    }
  }
  else if ( AOdd && ! BOdd ) {
    long diff = B - A ;
    long LSB = ( diff ) / 2 % 2 ;
    long BToCompare = B + LSB ;
    long AToCompare = A ;
    long solution = 0 ;
    long multiplier = 1 ;
    while ( BToCompare > 0 ) {
      if ( AToCompare == 0 ) {
        solution += BToCompare % 2 * multiplier ;
        BToCompare /= 2 ;
      }
      else {
        if ( BToCompare % 2 != AToCompare % 2 ) {
          solution += multiplier ;
        }
        BToCompare /= 2 ;
        AToCompare /= 2 ;
      }
      multiplier *= 2 ;
    }
    System . out . println ( solution ) ;
  }
  else if ( ! AOdd && BOdd ) {
    long diff = B - A ;
    long LSB = ( diff + 1 ) / 2 % 2 ;
    System . out . println ( LSB ) ;
  }
  else {
    long diff = B - A ;
    long LSB = ( diff ) / 2 % 2 ;
    System . out . println ( B + LSB ) ;
  }
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; boolean AOdd = A % 2 == 1 ; boolean BOdd = B % 2 == 1 ; if ( A == B ) { System . out . println ( A ) ; } else if ( AOdd && BOdd ) { long diff = B - A ; long LSB = ( diff ) / 2 % 2 ; if ( LSB == 1 ) { System . out . println ( A - 1 ) ; } else { System . out . println ( A ) ; } } else if ( AOdd && ! BOdd ) { long diff = B - A ; long LSB = ( diff ) / 2 % 2 ; long BToCompare = B + LSB ; long AToCompare = A ; long solution = 0 ; long multiplier = 1 ; while ( BToCompare > 0 ) { if ( AToCompare == 0 ) { solution += BToCompare % 2 * multiplier ; BToCompare /= 2 ; } else { if ( BToCompare % 2 != AToCompare % 2 ) { solution += multiplier ; } BToCompare /= 2 ; AToCompare /= 2 ; } multiplier *= 2 ; } System . out . println ( solution ) ; } else if ( ! AOdd && BOdd ) { long diff = B - A ; long LSB = ( diff + 1 ) / 2 % 2 ; System . out . println ( LSB ) ; } else { long diff = B - A ; long LSB = ( diff ) / 2 % 2 ; System . out . println ( B + LSB ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (parenthesized_expression (identifier)) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (identifier)))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (parenthesized_expression (identifier)) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (unary_expression operand: (identifier)) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (parenthesized_expression (identifier)) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))))))))))