import java.util.*

fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()

    var ret = 0
    var idx = 0
    while (true) {
        idx = s.indexOf("ABC", idx, false)
        if (idx >= 0) {
            ret++
        } else {
            break
        }
        idx++
    }
    print(ret)
}