function Main(input) {
	input = input.split("\n");

	const num = parseInt(input[0], 10);
	const str= input[1];

console.log ( (str.match( /ABC/g ) || [] ).length) ;

}

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