import java.util.*

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

  var index = -1
  var count = 0
  while (index <= s.length - 4) {
    index = s.indexOf("ABC", index)
    if (index >= 0) {
      count += 1
      index += 3
    } else {
      break
    }
  }
  println(count)
}