import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

void main() {
  readln;
  string s = readln.chomp;
  int count=0;
  for(int i=0; i<s.length-2; i++) {
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') count++;
  }
  writeln(count);
}

