#include <iostream>
#include <string>
using namespace std ; 
int main ()
{
	int l,j=0 ;
	string s; 
	cin>>l>>s;
	for ( int i=0 ; i<l;i++)
	{
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
			j=j+1;
	}
	cout<<j;
}