"use strict";
function main(input) {
  let n = parseInt(input[0]);
  let s = input[1];

  const a = s.trim().split("ABC");

  console.log(a.length-1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));