program main
  implicit none
  integer :: n, i, l, res
  character(50) :: s
  read (*, *) n
  read (*, *) s
  l = len(trim(s))
  res = 0
  do i = 1, l - 2
    if(s(i:i + 2) == "ABC") res = res + 1
  end do
  write (*, "(i0)") res
end program main
