'use strict'


function Main(input) {

  input = input.trim().split('\n')
  const N = parseInt(input[0])
  const str = input[1]

  let count = ( str.match( /ABC/g ) || [] ).length

  console.log(count)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));