{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

import GHC.Exts

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray array i f =  writeArray array i =<< f <$> readArray array i

main = do
	n <- readInt
	as <- readInts
	let
		f = map fst . filter snd . zip as . cycle
		evens = f [ True, False ]
		odds  = f [ False, True ]
	print $ minimum' ( n `div` 2 ) $ do
		( a, c1 ) <- take 2 $ majors evens
		( b, c2 ) <- take 2 $ majors odds
		guard $ a /= b
		return $ n - c1 - c2

majors as = runST $ do
	counts <- newArray ( 0, maximum as + 1 ) 0 :: ST s ( STUArray s Int Int )
	forM_ as $ \a -> do
		modifyArray counts a succ
	reverse . sortWith snd . filter ( ( 0 < ) . snd ) <$> getAssocs counts

minimum' a [] = a
minimum' _ as = minimum as
