import Foundation

extension String {
    func split(separator: String) -> [Int] {
        return self.componentsSeparatedByString(separator).map { Int($0)! }
    }
}

let input = readLine()!.split(" ")
let A = input[0]
let B = input[1]

var arr = [String]()
for i in A...B {
  	let tmp = Int(String(i, radix: 2))!
    arr.append(String(NSString(format: "%012d", tmp)))
}
var ans = ""
for i in 0..<12 {
    var oneCount = 0
    for j in arr {
        if (j.characters.map{String($0)})[i] == "1" {
            oneCount += 1
        }
    }
    if oneCount % 2 > 0 {
        ans += "1"
    } else {
        ans += "0"
    }
}

print(Int(ans, radix: 2)!)