import Data.List

scan :: [Int] -> Int
scan l = iter [] 2 sl where
    iter ac p [] = iter ac (p*2) sl
    iter ac p (x:xs)
        | p > limit = count ac
        | d <= 0    = iter ac (p*2) sl
        | elem d xs = iter ([x, d]:ac) p xs
        | otherwise = iter ac p xs
        where d = p - x
    limit = 10 ^ 9
    sl = sort l

count :: [[Int]] -> Int
count = iter [] where
    iter ac [] = length ac
    iter ac ([a, b]:xs)
        | take1 >= drop1 = take1
        | otherwise = drop1
        where
            take1 = iter ([a, b]:ac) (filter (\x -> not (elem a x || elem b x)) xs)
            drop1 = iter ac xs
  
readData :: IO [Int]
readData = do
    line1 <- getLine
    let xs = map (\x -> read x :: Int) (words line1)
    return xs

main :: IO() 
main = do
    n  <- readLn :: IO Int
    la <- readData
    let ans = scan la
    print ans