#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main()
{
	cin>>n>>s;
	int pos=s.find("ABC");
	int nc=0;
	while(pos!=string::npos){
		nc++;
		pos=s.find("ABC",pos+3);
	}
	cout<<nc<<endl; 
	return 0;
}