N = gets.to_i A = gets.split.map(&:to_i) x = A.inject(:|) pp 2 ** (0..100).find { |i| x[i] == 0 }