import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

main = do
  li <- BS.getLine
  let Just (n,_) = BS.readInt li
  li <- BS.getLine
  let as = unfoldr (BS.readInt . BS.dropWhile isSpace) li
  let ans = compute n as
  print ans

compute :: Int -> [Int] -> Int
compute n as = length $ sieve EmptyHP $ group $ sort as

sieve _ [] = []
sieve EmptyHP ((a:as):ass) = if null as then a : rest else rest
  where rest = sieve (insertHP (a+a,a) EmptyHP) ass
sieve hp@(HP (m,b) _ _ _) asss@((a:as):ass) =
  case compare m a of
    LT -> sieve mbs1 asss
    EQ -> sieve mbs1 ass
    GT -> if null as then a : rest else rest
  where
    mbs1 = insertHP (m+b,b) $ deleteHP hp
    rest = sieve (insertHP (a+a,a) hp) ass

data Heap a = EmptyHP | HP a Int (Heap a) (Heap a)

size EmptyHP = 0
size (HP _ n _ _) = n

insertHP v EmptyHP = HP v 1 EmptyHP EmptyHP
insertHP v (HP x n l r)
  | size l < size r = HP a (succ n) (insertHP b l) r
  | True            = HP a (succ n) l (insertHP b r)
  where
    a = min v x
    b = max v x

deleteHP (HP _ n l@(HP lv _ _ _) r@(HP rv _ _ _))
  | lv < rv = HP lv (pred n) (deleteHP l) r
  | True    = HP rv (pred n) l (deleteHP r)
deleteHP (HP _ _ l EmptyHP) = l
deleteHP (HP _ _ EmptyHP r) = r
-- deleteHP (HP _ _ EmptyHP EmptyHP) = EmptyHP
