import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()
    val S = scn.next()

    var cnt = 0

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

    println(cnt)
}