'use strict';
const main = input => {
  const n = parseInt(input[0]);
  let s = input[1];
  let ans = 0;
  for(let i=0; i<s.length-2; i++) {
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
      ans++;
    }
  }
  console.log(ans);
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));