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 [] $ group $ sort as

sieve _ [] = []
sieve [] ((a:as):ass) = if null as then a : rest else rest
  where rest = sieve [(a+a,a)] ass
sieve mbmbs@((m,b):mbs) 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 = insert (m+b,b) mbs
    rest = sieve (insert (a+a,a) mbmbs) ass