#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
string s;
cin>>s;
int counter=0;
for(int i=0; i<N-2;i++){
if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C'){
counter++;}}
cout<<counter<<endl;}
