#include <iostream>
#include <string>

using namespace std;
int main(){
	int i,j,n,cnt = 0;
	string s;
	cin >> n >> s;
	for(i=0;i<n - 2;i++){
		string u = s.substr(i,3);
		if(u=="ABC") cnt++;
	}
	cout << cnt << endl;
}