import Control.Arrow
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = getLine >> breads >>= print . solve 

solve :: [Int] -> Int
solve xs
    | all (\x -> head xs == x) (tail xs) = length xs `div` 2
    | otherwise = count ys + count zs
    where
        count = check . map length . group . sort 
        check [_] = 0
        check x = minimum x
        (ys, zs) = fst $ foldl' ff (([], []), True) xs
        ff ((a, b), c) x
            | c = ((x : a, b), not c)
            | otherwise = ((a, x : b), not c)

breads :: IO [Int]
breads = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine