#include<iostream>
#include<string>
using namespace std;
int main(){
	int N,sum=0;
	string S;
	cin>>N>>S;
	for(int i=0;i<S.length()-2;i++){
		if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')sum++;
	}
	cout<<sum;
	return 0;
}