      PROGRAM piyo
      IMPLICIT NONE
      integer :: n
      character(50) :: s
      integer :: i, ans=0
      
      read*,n
      read*,s
      
      do i = 1,n-2
        if( s(i:i+2)=='ABC' )then
          ans = ans + 1
        end if
      end do
      
      print*,ans
      
      
      
      
      
      END PROGRAM