puts"Gray code n=%d"%n=gets.to_i (2**n).times{|a|puts"%0#{n}b"%(a^a/2)}