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

int main(){
	char s[60], *next;
	int n, c = 0;
	next = s;
	scanf("%d %s", &n, s);
	while((next = strstr(next, "ABC")) != NULL){
		c++;
		next++;
	}
	printf("%d\n", c);
}