import Control.Applicative ((<$>)) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B import Data.List (unfoldr) import Data.List (foldl') import Data.Char (isSpace) import Data.Bits (xor) import Data.IntSet (IntSet) import qualified Data.IntSet as IS main :: IO () main = do getLine solve <$> readil B.readInt <$> B.getLine >>= print solve :: [Int] -> Int solve = IS.size . foldl' f (IS.singleton 0) where f is x = let ts = IS.foldl g IS.empty is in IS.union is ts where g s k = IS.insert (k `xor` x) s readil :: Integral a => (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a] readil f = unfoldr g where g s = do (n, s') <- f s return (n, B.dropWhile isSpace s')