'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const str = arr[1];
  let count = 0;

  for (let i = 0; i < str.length - 2; i ++) {
    if (str[i] === 'A' && str[i + 1] === 'B' && str[i + 2] === 'C') {
      count ++;
    }
  }
  
  console.log(count);
}

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