#include<iostream>
#include<string>
using namespace std;
int main() {
  string s;
  cin >> s >> s;
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    ans += (s.substr(i, 3) == "ABC");
  }
  cout << ans << endl;
}