import Data.Bits import Data.Array main = do n <- read <$> getLine :: IO Int ns <- listArray (1,n) . map read . words <$> getLine :: IO (Array Int Int) print $ dp ns dp :: Array Int Int -> Int dp ns = sum [if memo!(n,i) then 1 else 0|i<-[0..40000]] where (_,n) = bounds ns memo = array ((0,0), (n, 40000)) $ [((y,x), f y x)|y<-[0..n], x<-[0..40000]] f 0 0 = True f 0 _ = False f y x = memo!(y-1, x) || (if x `xor` ns!y < 40000 then memo!(y-1, x `xor` (ns!y)) else False)