program countabc
  implicit none
  integer :: n,l,ans,i
  character::s
 
  read*,n,s 
  l=len_trim(s)
  
  ans=0
  do i=1,l-2
   if(s(i:i+2)=='ABC') ans=ans+1
  end do

  print*,ans

end program countabc
  
 
  