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