module Main (main) where import Data.Bits import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B import Control.Applicative import Data.Maybe(fromJust) import Data.List import Debug.Trace default (Int) getInt :: IO Int getInt = fst . fromJust . B.readInt <$> B.getLine getInts :: IO [Int] getInts = map (fst . fromJust . B.readInt) <$> B.words <$> B.getLine main :: IO () main = do _n <- getInt as <- getInts print $ solve as solve :: [Int] -> Int solve = (2^) . length . sweep 60 sweep :: Int -> [Int] -> [Int] sweep (-1) xs = xs sweep b xs = case find (`testBit` b) xs of Nothing -> sweep (b-1) xs Just x -> let xs' = map (f x) xs xs'' = filter (/= 0) xs' in x: sweep (b-1) xs'' where f :: Int -> Int -> Int f x y = if 0 == (y .&. (1 `shiftL` b)) then y else y `xor` x