import           Control.Arrow ((***))
import           Data.List     (partition)

main :: IO ()
main = interact $ (++ "\n") . show . solve . map fromChar

data Cube =
    Red
  | Blue
  deriving (Eq)

fromChar :: Char -> Cube
fromChar '0' = Red
fromChar '1' = Blue
fromChar _   = error "unexpected character"

solve :: [Cube] -> Int
solve = (2 *) . uncurry min . (length *** length) . partition (Red ==)
