X = gets.to_i (0..62).each do |m| n = X ^ m if n.to_s(2).count(?1) == m puts n exit end end puts -1