fun main (args : Array<String>) {
	val n = readLine()!!.toInt()
	val s = readLine()!!
	var list : MutableList<String> = mutableListOf()
	var count : Int = 0
	for (i in s) {
		list.add(i.toString())
	}
	for (i in 0..n - 3) {
		if (list[i] == "A" && list[i + 1] == "B" && list[i + 2] == "C") {
			count++
		} else {
			continue
		}
	}
	println("${count}")
}