#include<iostream>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n>>s;
	int x=0;
	for(int i=0;i<=n-3;i++){
		if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C'){
			x++;
		}
	}
	cout<<x<<endl;
}