class Yukicoder def initialize n = gets.to_i a = gets.chomp.split.map(&:to_i) dp = Hash.new dp[0] = true a.each do |i| temp = dp.dup dp.each do |k,v| val = k ^ i temp[val] = true end dp = temp.dup end puts dp.size end end Yukicoder.new