A, B = gets.split.map(&:to_i) all = 1 same = 1 (0 ... 31).each do |bit| case [A[bit], B[bit]] when [0, 1] all *= 2 same = 0 when [1, 0] all = same = 0 end end puts (all + same) / 2