(defn count-flip
  "start-with could be \\0 or \\1
   pattern a seq of characters"
  [start-with pattern]
  (loop [expecting start-with
         [c & r] pattern
         flip-count 0]
    (if (not c)
      flip-count
      (recur (case expecting \0 \1 \1 \0)
             r
             (if (= expecting c) flip-count (inc flip-count))))))
(defn abc124-C [pattern]
  (min (count-flip \0 pattern)
       (count-flip \1 pattern)))
(defn main-abc124-C []
  (let [pattern (read-line)]
    (println (abc124-C pattern))))
(main-abc124-C)