import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var cnt = 0
    for(i in 0 until n - 2){
        if(s.substring(i,i + 3) == "ABC") cnt++
    }
    println(cnt)
}
