# https://atcoder.jp/contests/abc150/tasks/abc150_b

read n ; n=$((n))
read S
l=${#S}
ans=$((0))
for ((i = 0; i < l; i++)) ; do
  str=${S:i:3}
  if [ $str = "ABC" ] ; then
    ans=$((ans + 1))
  fi
done
echo $ans
