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

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