((stdin) => {
	const [n, s] = stdin.split('\n');
	let res = s.match(/ABC/g);
	if (res === null) {
		console.log(0);
	}
	else {
		console.log(res.length);
	}
})(require('fs').readFileSync('/dev/stdin', 'UTF-8'))
