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 $ sortBy (flip compare) as solve :: [Int] -> Int solve xs = (2^) $ length $ filter (/=0) $ sweep (1 `shiftL` 60) xs sweep :: Int -> [Int] -> [Int] sweep 0 as = as sweep _ [] = [] sweep b as = sweep (b `shiftR` 1) $ sweepBy as b sweepBy :: [Int] -> Int -> [Int] sweepBy [] _ = [] sweepBy xs b = case find ((0/=) . (b .&.)) xs of Nothing -> xs Just x -> x:(filter (/=0) . map (f x)) xs where f x y = if y .&. b == 0 then y else x `xor` y