require 'set' def f(e) e2=e (e.size..14).each{ e2="0"+e2 } return e2 end gets.to_i as=gets.split.map{|e| e.to_i.to_s(2)} bs=as.map{|e| f(e) }.sort.reverse.uniq dp=Hash.new(0) dp[0]=1 p2=0 (0..14).each{|p1| dp2=Hash.new(0) while bs.size>p2 && bs[p2][p1]=="1" dp.keys.each{|e1| e2=bs[p2] e2=(e1^(e2.to_i(2))).to_s(2) e2=f(e2) (0..(p1-1)).each{|i| e2[i]="0" } dp2[e2.to_i(2)]+=dp[e1] e3=f(e1.to_s(2)) (0..(p1-1)).each{|i| e3[i]="0" } dp2[e3.to_i(2)]+=dp[e1] } p2+=1 end if dp2.empty? == false dp=dp2 end } ans=0 dp.values.each{|e| ans+=e } puts ans