program main

  implicit none
  integer :: N, i, j, k
  character(50) :: S 

  read(*,*) N
  read(*,*) S
  
  j = 0
  do i = 0, N
    if ( S(i:i+2) == "ABC" ) then
      j = j + 1
    end if
  end do
  print*, j

    
end program main
