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 xs (1 `shiftL` 60) sweep :: [Int] -> Int -> [Int] sweep as 0 = as sweep [] _ = [] sweep as@(x:_) b | x .&. b == 0 = sweep as (b `shiftR` 1) | otherwise = case sweep' as b of [] -> [] p:ps -> p:sweep ps (b `shiftR` 1) sweep' :: [Int] -> Int -> [Int] sweep' [] _ = [] sweep' xs@(a:as) b | (a .&. b) == 0 = xs | otherwise = a:(sortBy (flip compare) $ map f as) where f e = if e .&. b /= 0 then e `xor` a else e