#include <bits/stdc++.h>
using namespace std;
int main(){
     int a,q=0;
     string s;
     cin>>a>>s;
     for(int i=0;i<=a;i++){
     	if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C'){
     	q++;
		}
	}
	cout<<q;
}