n=1 a=gets(p).map(&:to_i).sort a.reject!{|i|i%n>0&&i>n&&!p(i)}while 99>n*=2 $><