import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val s = sc.next
  val replaced = s.replace("ABC","").length
  println((n - replaced) / 3 )
}
