function Main(input) {
	var lines = input.split("\n");
	var n = Number(lines[0]);
	var s = lines[1];
	var match = s.match(/ABC/g)
	console.log(match === null  ? 0 : match.length)

}

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