(def N (read-string (read-line)))
(def S (read-line))
(println (loop [i 0 ans 0] 
  (if (> i (- N 3))
    ans
    (if (= (subs S i (+ i 3)) "ABC")
      (recur (+ i 1) (+ 1 ans))
      (recur (+ i 1) ans)))))  