#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
//#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

string bigsum(string A, string B) {
	//A+Bを返す
	vector<char>num(10);
	num = { '0','1','2','3','4','5','6','7','8','9' };
	if (A.size() > B.size()) {
		swap(A, B);
	}
	int a = A.size();
	int b = B.size();
	int size = b+1;
	reverse(A.begin(),A.end());
	reverse(B.begin(),B.end());
	vector<int>V(size, 0);
	rep(i, a) {
		V[i] = (A[i] - '0') + (B[i] - '0');
	}
	for (int i = a; i < b; i++) {
		V[i] = (B[i] - '0');
	}
	rep(i, size - 1) {
		V[i + 1] += (V[i] / 10);
		V[i] %= 10;
	}
	reverse(V.begin(),V.end());
	int flag = false;
	string ret;
	rep(i, size) {
		if (V[i] == 0 && flag == false)continue;
		else {
			ret.push_back(num[V[i]]);
			flag = true;
		}
	}
	return ret;
}

string bigmulti(string A, string B) {
	//A*Bを返す
	vector<char>num(10);
	num = { '0','1','2','3','4','5','6','7','8','9' };
	if (A.size() > B.size()) {
		swap(A, B);
	}
	int a = A.size();
	int b = B.size();
	int size = a+b;
	reverse(A.begin(),A.end());
	reverse(B.begin(),B.end());
	vector<int>V(size, 0);
	for (int i = 0; i < a; i++ ) {
		for (int j = 0; j < b; j++ ) {
			V[i + j] += ((A[i] - '0') * (B[j] - '0'));
		}
	}
	rep(i, size - 1) {
		V[i + 1] += (V[i] / 10);
		V[i] %= 10;
	}
	reverse(V.begin(),V.end());
	int flag = false;
	string ret;
	for (int i = 0; i < size; i++ ) {
		if (V[i] == 0 && flag == false)continue;
		else {
			ret.push_back(num[V[i]]);
			flag = true;
		}
	}
	return ret;
}

bool bigcomp(string A, string B) {
	//A>=Bならtrue A<Bならfalseを返す
	if (A.size() > B.size())return true;
	else if (A.size() < B.size())return false;
	else {
		if (A >= B)return true;
		else return false;
	}
}

string bigdif(string A, string B) {
	//AとBの差の絶対値を返す
	vector<char>num(10);
	num = { '0','1','2','3','4','5','6','7','8','9' };
	if (A.size() < B.size())swap(A,B);
	else if(A.size()==B.size()){
		if (A < B)swap(A,B);
	}
	int a = A.size();
	int b = B.size();
	int size = a;
	reverse(A.begin(), A.end());
	reverse(B.begin(), B.end());
	vector<int>V(size, 0);
	rep(i, b) {
		V[i] = (A[i] - '0') - (B[i] - '0');
	}
	for (int i = b; i < size; i++) {
		V[i] = (A[i] - '0');
	}
	int flag = false;
	reverse(V.begin(),V.end());
	rep(i, size - 1) {
		if (V[i] == 0 && flag == false)continue;
		else {
			V[i]--;
			V[i + 1] += 10;
			flag = true;
		}
	}
	reverse(V.begin(), V.end());
	rep(i, size - 1) {
		V[i + 1] += (V[i] / 10);
		V[i] %= 10;
	}
	reverse(V.begin(), V.end());
	flag = false;
	string ret;
	rep(i, size) {
		if (V[i] == 0 && flag == false)continue;
		else {
			ret.push_back(num[V[i]]);
			flag = true;
		}
	}
	return ret;
}

/*string bigdiv(string A, string B) {
	//A/Bを返す
	vector<char>num(10);
	num = { '0','1','2','3','4','5','6','7','8','9' };
	if (A.size() < B.size())swap(A, B);
	else if (A.size() == B.size()) {
		if (A < B)swap(A, B);
	}
	int a = A.size();
	int b = B.size();
}*/
int main() {
	/*string A, B;
	cin >> A >> B;
	cout << bigsum(A, B) << endl;
	cout << bigmulti(A, B) << endl;
	cout << bigcomp(A, B) << endl;
	cout << bigdif(A, B) << endl;*/
	
	int N;
	string S;
	cin >> N >> S;
	int cnt = 0;
	rep(i, N - 2) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
			cnt++;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256