fun main(args: Array<String>) {
    val N = nextInt()
    val S = next()
    var ans = 0
    for (n in 0.. N-3) {
        if (S.substring(n, n+3) == "ABC") ans += 1
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta