let a=Int(readLine()!)!
let s=Array(readLine()!.characters)

var ans = 0
var i = 0
for i in 0..<a {
  if ( (i + 3 <= a) ) {
  	if(s[i] == "A" && s[i + 1] == "B" && s[i + 2] == "C") {
      ans += 1
    }
  } else {
    break
  }
}

print(ans)