A, B = gets.split.map(&:to_i) if 30.times.any?{|i| B[i] == 0 && A[i] == 1} puts 0 else n = 32.times.count {|i| !(B[i] == 0 || A[i] == 1) } puts (1 << n - 1) end