'use strict';
console.log(function(args){
  const _tmp = args.trim().split('\n');
  const N = _tmp[0]|0;
  const S = _tmp[1];
  let count = 0;
  for ( let i = 0; i + 3 <= N; i++ ) {
    if ( S.slice(i,i+3) === 'ABC' ) count++;
  }
  return count.toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
