n = gets.to_i a = gets.split.map(&:to_i) a.uniq! h = Hash.new(0) nh = Hash.new(0) h[0] = 1 nh[0] = 1 n = a.length n.times do |i| h[a[i]] = 1 nh[a[i]] = 1 end while true do nnh = Hash.new(0) nh.each_key do |x| h.each_key do |y| xor = x ^ y if !h.has_key?(xor) nnh[xor] = 1 end end end if nnh.length == 0 break end nh = nnh h.merge!(nnh) end puts h.length