
object Main extends App {

  val n = scala.io.StdIn.readInt()
  val s = scala.io.StdIn.readLine()

  def solve(): Int = {
    var ans = 0
    for(i <- 0 until n-2) {
      if(s(i) == 'A' && s(i+1) == 'B' && s(i+2) == 'C') ans += 1
    }
    ans
  }


  println(solve)

}
