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