program main
  implicit none
  integer :: N
  character(len=50) :: S
  integer :: out, i
  read(*,*) N
  read(*,*) S
  out = 0
  do i = 1,N
     if ( S(i:i+2) == 'ABC' ) out = out + 1
  end do
  write(*,'(i0)') out
  stop
end program main
