"use strict";

function main(input) {
  input = input.trim().split("\n");
  const N = parseInt(input[0]);
  const S_arr = input[1].split("");
  let ans = 0;
  for (let i = 0; i < N; i++) {
    if (S_arr[i] === "A") {
      if (S_arr[i + 1] === "B") {
        if (S_arr[i + 2] === "C") {
          ans++;
        }
      }
    }
  }
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));
