program test02
 character*50 S
 character*3 ic
 integer N
 integer i, j
 integer :: countA=0
 
 read *,N
 read *,S
 
 do j=3,N
  i=j-2
  ic=S(i:j)
  if (ic=='ABC') then
   countA=countA+1
  end if
 end do
 
 print '(i0)', countA