function main(lines) {
  const N = n();
  const S = s();

  let ans = 0;
  for (let i = 0; i < N-2; i++) {
    if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C')
      ans++;
  }
  
  return ans;
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);

const ans = main(lines);
console.log( ans );