import java.util.*;

class Main{
    //
    static final long DIV = 100000007L;
    static final int MAX = 2000000000;
    //static long[] fac = new long[MAX];
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        s = s.replaceAll("ABC", "1");
        char[] ary = s.toCharArray();
        int ans = 0;
        for(int i = 0;i < ary.length;i++){
            if(ary[i]=='1')ans++;
        }
        System.out.println(ans);
    }

    static long modpow(long n){
        long ans =1;
        long a = 2;
        long m = n;
        while(m>0){
            if((m&1)==1)ans = ans*a % DIV;
            a = a * a % DIV;
            m >>= 1;
        }
        return ans;
    }

    static long modcomb(long n,long r){
        return 1;
    }
    
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz