fun main (args:Array<String>){
    val N = readLine()!!.toInt()
    val S = readLine()!!

    var countABC = 0
    for (i in 3..N) {
        if (S.substring(i - 3, i) == "ABC") countABC++
    }
    print(countABC)
}
