function Main(input) {
  input = input.trim()
  input = input.split("\n");
  var S = input[1].split("");
  var ans = 0;
  for(var i=0;i<S.length-1;i++){
    if(S[i]=="A"&&S[i+1]=="B"&&S[i+2]=="C"){
      ans++
      i+=2;
    }
  }
  console.log(ans)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));