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