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

    val A = "ABC"

    var res = 0L

    for (i in S.indices) {
        if (i + 3 > S.length) continue

        if (S.substring(i, i + 3) == A)
            res++
    }

    println(res)
}
