function Main (input) {
  input = input.split("\n");
  var N = parseInt(input[0], 10);
  var S = input[1].split("");
  var ans = 0;
  for (var i = 0; i < N; i++) {
    if (S[i] == "A" && S[i+1] == "B" && S[i+2] == "C") {
      ans++;
    }
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));