#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	string p;
	cin>>p;
	int ans=0;
	for(int i=0;i<n;i++){
		if(p[i]=='A' && p[i+1]=='B' && p[i+2]=='C') ans++;
	}
	cout<<ans<<endl;
}