fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val s = readLine() ?: return
    val count = 0.until(s.length - 2).count { i ->
        s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C'
    }
    println(count)
}