using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder_Answer
{
    class Program
    {
        const int mod = 1000000007;

        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            string S = ReadLine();
            int AnsCount = 0;

            for (int loop = 0; loop < S.Length - 2; loop++) 
            {
                if (S.Substring(loop, 3) == "ABC") AnsCount++;
            }

            WriteLine(AnsCount);
        }
    }

    public static class Extension
    {
        #region 拡張:bool
        public static int ToInt(this bool Bool) 
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr) 
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion

        #region 拡張:int
        public static char ToAlphaBets_Small(this int Base) 
        {
            switch (Base) 
            {
                case 0:
                    return 'a';
                case 1:
                    return 'b';
                case 2:
                    return 'c';
                case 3:
                    return 'd';
                case 4:
                    return 'e';
                case 5:
                    return 'f';
                case 6:
                    return 'g';
                case 7:
                    return 'h';
                case 8:
                    return 'i';
                case 9:
                    return 'j';
                case 10:
                    return 'k';
                case 11:
                    return 'l';
                case 12:
                    return 'm';
                case 13:
                    return 'n';
                case 14:
                    return 'o';
                case 15:
                    return 'p';
                case 16:
                    return 'q';
                case 17:
                    return 'r';
                case 18:
                    return 's';
                case 19:
                    return 't';
                case 20:
                    return 'u';
                case 21:
                    return 'v';
                case 22:
                    return 'w';
                case 23:
                    return 'x';
                case 24:
                    return 'y';
                case 25:
                    return 'z';

                default:
                    return '0';
            }
        }

        public static char ToAlphaBets_Big(this int Base)
        {
            switch (Base)
            {
                case 0:
                    return 'A';
                case 1:
                    return 'B';
                case 2:
                    return 'C';
                case 3:
                    return 'D';
                case 4:
                    return 'E';
                case 5:
                    return 'F';
                case 6:
                    return 'G';
                case 7:
                    return 'H';
                case 8:
                    return 'I';
                case 9:
                    return 'J';
                case 10:
                    return 'K';
                case 11:
                    return 'L';
                case 12:
                    return 'M';
                case 13:
                    return 'N';
                case 14:
                    return 'O';
                case 15:
                    return 'P';
                case 16:
                    return 'Q';
                case 17:
                    return 'R';
                case 18:
                    return 'S';
                case 19:
                    return 'T';
                case 20:
                    return 'U';
                case 21:
                    return 'V';
                case 22:
                    return 'W';
                case 23:
                    return 'X';
                case 24:
                    return 'Y';
                case 25:
                    return 'Z';

                default:
                    return '0';
            }
        }
        #endregion

        #region 拡張:char
        public static int Toint(this char Char) 
        {
            switch (Char) 
            {
                case 'a':
                case 'A':
                    return 0;

                case 'b':
                case 'B':
                    return 1;

                case 'c':
                case 'C':
                    return 2;

                case 'd':
                case 'D':
                    return 3;

                case 'e':
                case 'E':
                    return 4;

                case 'f':
                case 'F':
                    return 5;

                case 'g':
                case 'G':
                    return 6;

                case 'h':
                case 'H':
                    return 7;

                case 'i':
                case 'I':
                    return 8;

                case 'j':
                case 'J':
                    return 9;

                case 'k':
                case 'K':
                    return 10;

                case 'l':
                case 'L':
                    return 11;

                case 'm':
                case 'M':
                    return 12;

                case 'n':
                case 'N':
                    return 13;

                case 'o':
                case 'O':
                    return 14;

                case 'p':
                case 'P':
                    return 15;

                case 'q':
                case 'Q':
                    return 16;

                case 'r':
                case 'R':
                    return 17;

                case 's':
                case 'S':
                    return 18;

                case 't':
                case 'T':
                    return 19;

                case 'u':
                case 'U':
                    return 20;

                case 'v':
                case 'V':
                    return 21;

                case 'w':
                case 'W':
                    return 22;

                case 'x':
                case 'X':
                    return 23;

                case 'y':
                case 'Y':
                    return 24;

                case 'z':
                case 'Z':
                    return 25;

                default:
                    return -1;
            }
        }

        public static char NextAlpha(this char Char) 
        {
            int AfterInt = Char.Toint() + 1;
            if (Char.ToString() == Char.ToString().ToLower()) return AfterInt.ToAlphaBets_Small();
            else return AfterInt.ToAlphaBets_Big();
                
        }
        #endregion
    }
}


Measured memory_bytes: 11092