fun main(args: Array<String>) {
    readLine()!!
    val str = readLine()!!

    var count = 0
    for (i in (str.lastIndex - 2) downTo 0 ) {
        if (str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C') {
            count += 1
        }
    }

    println(count)
}