Imports System
Module ABC150B
	Sub Main()
		Dim n As Integer 
		Dim s As String 
		Dim ans As Integer = 0
		s = Console.ReadLine()
		n = Integer.Parse(s)
		s = Console.ReadLine()
		For i = 0 To n-3
			If s.SubString(i,3) = "ABC"
				ans += 1
			End If
		Next
		Console.WriteLine(ans)
	End Sub
End Module

